×

go · level 1 · unit 2 · lesson 3

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

A good name tells you what is in the box.

A name can use letters, digits and the underscore _. It cannot contain spaces, and it cannot start with a digit: pet2 is fine, 2pets is not. Case matters, so pet and Pet are two different boxes.

Some words are taken. A such as func, var or import already means something to Go, so it cannot be a name.

Pick names that say what is inside: score beats s. When a name needs several words, Go uses , like petName or bestFriend. Each new word starts with a capital, like the humps on a camel.

package main
import "fmt"
func main() {
	petName := "Biscuit"
	favouriteFood := "pizza"
	pet2 := "Pickles"
	fmt.Println(petName, favouriteFood, pet2)
}

Go does not care what a name means, only that you spell it the same way every time.