Skip to content
← Index | Lesson 2 of 5

Basic match

match in Zolo

match is Zolo's pattern matching — more powerful than a switch:

let day = 3
let name = match day {
    1 => "Monday",
    2 => "Tuesday",
    3 => "Wednesday",
    4 => "Thursday",
    5 => "Friday",
    _ => "Weekend",
}
print(name) // Wednesday

Goal: Use match to classify a score (0-100) into a grade (A, B, C, D, F).

lesson-3-2.zolo
Program output

Run the code to see the output

Search Zolo

9 results

enespt-br