Every journey into code begins with "Hello World". I don't know why, but that's what we do. It's a safe way of checking that you've got your language installed correctly and can at least run the most basic of basics - that of outputting something (in this case, some text) to the user.
Golang, being C-Syntax inspired language, should look fairly familiar to pretty much anyone in the computer sciences. A nice simple Hello World application can be written as follows:
package main
import "fmt"
func main() {
fmt.Println("Hello World from Golang")
}
Saving the above code as 'hello.go' and then typing the following on the command line:
go run hello.go
should net you a lovely little message:
Hello World from Golang
No comments:
Post a Comment