×

go · level 1 · unit 4 · 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

adds more paths to the fork.

Some questions have more than two answers. What should you wear? It depends how cold it is. else if adds another condition to check when the ones above it were false.

Go checks from the top down and stops at the first condition that is true. Only that block runs. Stack as many else if parts as you like, then add an else to catch the rest.

Every gives true or false. < means less than, > more than, <= less than or equal to, >= more than or equal to, and != not equal to.

package main
import "fmt"
func main() {
	temperature := 12
	if temperature < 5 {
		fmt.Println("Wear a big coat.")
	} else if temperature < 15 {
		fmt.Println("A jumper will do.")
	} else {
		fmt.Println("T-shirt weather!")
	}
}

In <= and >= the = always comes second, never first.