if/else is an expression in Zolo — it returns a value:
if
else
let x = 10 let msg = if x > 5 { "big" } else { "small" } print(msg) // big
Goal: Write a function sign(n) that returns "positive", "negative" or "zero". Test with 5, -3 and 0.
sign(n)
"positive"
"negative"
"zero"
Run the code to see the output
9 results