Skip to content
Course map | Lesson 1 of 5

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) // big

Goal: 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

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br