Control Flow

mimas’s control-flow constructs — if, match, and the loops — are all expressions: each one can evaluate to a value, not just steer execution. That single idea shows up everywhere in this section, so it’s worth keeping in mind:

let label = if score >= 50 { "pass" } else { "fail" };

let kind = match tag {
    0 => "circle",
    _ => "other",
};

let first_even = for n in numbers { if n % 2 == 0 { break n; } };

The pages here cover if & if let, match, the loop / while / for family, and the collect operator for building arrays out of a loop.