The Go && operator means and.
A condition using && is true only when both sides are true:
weather := "rainy"
temperature := 90
if weather == "sunny" && temperature > 85 {
fmt.Println("Going to the beach")
} else {
fmt.Println("Learning to code")
}
Here the temperature is high enough, but the weather is not sunny, so the whole condition is false.
Assignment
Use && to check both beach conditions.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
