

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Conditionals
incomplete
2: The Initial Statement of an If Block
incomplete
3: Switch
incomplete
4: Calculate Balance
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
if statements in Go do not use parentheses around the condition:
if height > 4 {
fmt.Println("You are tall enough!")
}
else if and else are supported as you might expect:
if height > 6 {
fmt.Println("You are super tall!")
} else if height > 4 {
fmt.Println("You are tall enough!")
} else {
fmt.Println("You are not tall enough!")
}
Unlike other languages, you must put the opening brace on the same line as the condition and not on a new line.
Fix the bug on line 12. If messageLen is less than or equal to the maxMessageLen the program should print "Message sent", else it should print "Message not sent".
Here are some of the comparison operators in Go:
== equal to!= not equal to< less than> greater than<= less than or equal to>= greater than or equal to