Javatpoint Logo
Javatpoint Logo

Go Hello World Example

Output:

Hello, World

The First line is the package deceleration, here the name of the package is main. Package deceleration is mandatory for all the go programs.

The next line is an import statement, here we are importing "fmt". The compiler will include the files of the package fmt.

The next line is a main() function, all execution begins with the main function.

The next line fmt.Println(...) is a function available in Go. This function will print the message "Hello, World" on the screen.

How to run Go program:

We have saved the program as Hello.go. To run the program, open the command prompt and write:

Output:

Hello, World

Next TopicGo Data Types





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA