typeover
rust curriculum

Curriculum Foundations Functions and expressions exercise 2 · mcq

Functions and expressions

Pick the function that returns () — the unit type. A function with no return arrow returns unit; the explicit form spells it out.

TypeScript reference
Pick the idiomatic Go translation

About this theme

Rust functions use explicit parameter and return types. Blocks can produce values, and the final expression has no semicolon. This is the first theme where a missing or extra semicolon changes meaning. Planned exercises: 1. choose fn syntax. 2. recognise -> return types. 3. choose final-expression return. 4. fill a parameter type. 5. fill a return type. 6. write a simple pure function. 7. write an if expression return. 8. translate TS helper functions. 9. fix a function where a semicolon accidentally returns ().