×

go · level 1 · unit 2 · lesson 2

  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 box can hold something new.

Boxes can change. mood = "awake" takes the old value out of mood and puts the new one in. This is called assigning. Use := once, to make the box. After that, plain = does the job.

You can copy one box into another, like best = mood. You can also strings with +: "fish" + "cake" makes "fishcake". Add your own spaces, because + never adds any.

package main
import "fmt"
func main() {
	mood := "sleepy"
	fmt.Println("I feel", mood)
	mood = "awake"
	fmt.Println("Now I feel", mood)
	greeting := "Good" + " morning"
	fmt.Println(greeting)
}

A box holds one value at a time, so the old one is gone for good.