The Go || operator means or.
A condition using || is true when at least one side is true:
weather := "sunny"
temperature := 90
if weather != "sunny" || temperature <= 85 {
fmt.Println("Learning to code")
} else {
fmt.Println("Going to the beach")
}
Here neither "bad beach condition" is true, so the else branch runs.
Assignment
Use || to check whether either condition keeps us from the beach.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
