Control Flow · 3.1
if/else as Expression
All lessons are open — jump whenever you need.
if/else is an expression in Zolo — it returns a value:
let x = 10
let msg = if x > 5 { "big" } else { "small" }
print(msg) // bigGoal: Write a function sign(n) that returns "positive", "negative" or "zero". Test with 5, -3 and 0.
lesson-3-1.zolo
Program output
Run the code to see the output