typeover
rust curriculum

Curriculum Foundations Control flow exercise 2 · mcq

Control flow

In Rust, if is an EXPRESSION — it produces a value you can bind to a let. Pick the idiomatic Rust translation of the TS ternary.

TypeScript reference
Pick the idiomatic Go translation

About this theme

Rust's if and loops look familiar, but they are expressions more often than TypeScript developers expect. This theme covers if, else if, loop, while, for, ranges, break, continue, and match only as a first glimpse. Planned exercises: 1. choose Rust if syntax without parentheses. 2. choose an if expression value. 3. recognise for n in 0..5. 4. fill a range. 5. fill break with a value from loop. 6. write a while condition. 7. write a for loop over a range. 8. translate TS branching code. 9. write a small counter that prints selected values.