Complete the code to check if x is greater than 10.
if x [1] 10 { fmt.Println("x is greater than 10") }
The greater than operator > checks if x is more than 10.
Complete the code to print "Even" if number is divisible by 2.
if number [1] 2 == 0 { fmt.Println("Even") }
The modulus operator % gives the remainder. If remainder is 0 when divided by 2, the number is even.
Fix the error in the if statement to check if age is at least 18.
if age [1] 18 { fmt.Println("Adult") }
The operator >= means 'greater than or equal to', so it checks if age is 18 or more.
Fill both blanks to print "Valid" if score is between 50 and 100 inclusive.
if score [1] 50 && score [2] 100 { fmt.Println("Valid") }
The condition checks if score is at least 50 (>=) and at most 100 (<=).
Fill all three blanks to create a map of words to their lengths for words longer than 3 characters.
lengths := map[string]int{}
for _, [3] := range words {
if len([3]) > 3 {
lengths[[1]] = [2]
}
}The map uses the word as key and its length as value. The loop variable is word.
