Skip to content

If

Beginner · Fundamentals

if is the most basic type of control flow. Go does not have pattern matching so if is widely used.

Return the larger of two numbers using if.

Show hint
Use an if statement to compare a and b, and return the larger number.

Source

Map each input string to an output with if/else.

Show hint
Implement fooIfFizz function by using if and else statements.

Source