CodeNest

Hello, Go

Every Go program declares a package and imports what it needs:

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

fmt.Println prints its arguments separated by spaces, plus a newline. Go is compiled and unused imports are compile errors – the compiler keeps you honest.

Try it

Print:

Hello, Go!
Go unavailable
Next
Running Go needs a server execution engine, which isn't configured on this deployment. You can still read the lesson and try the code locally.
Loading editor…

Press Ctrl/ + Enter or click Run to see the output here.