Conditional Statements

if/else if/else without parentheses, logical && and ||.

Go's if statement is written without parentheses around the condition, but the body's curly braces are always mandatory — even for a single line. Another style rule the compiler enforces: else goes on the same line as the closing brace. Comparisons: == != < > <= >=; connectives: && (AND), || (OR), ! (NOT).
Go

Enter a number — the program will say whether it is even

Multiple branches — via else if. The program below finds the largest of three numbers.
Go

Enter three numbers, for example: 3 9 5

Task: read an age and print "school" if it is between 7 and 17 inclusive, otherwise "other". Then solve the attached problem "Even or Odd" and mark the lesson as completed.

Practice problems

Доска