Getting Started
hello.go
Run directly
Or try it out in the Go repl
Variables
var s1 string
s1 = "Learn Go!"
// declare multiple variables at once
var b, c int = 1, 2
var d = true
Short declaration
Functions
package main
import "fmt"
// The entry point of the programs
func main() {
fmt.Println("Hello world!")
say("Hello Go!")
}
func say(message string) {
fmt.Println("You said: ", message)
}