typeover
rust curriculum

Curriculum Foundations Functions and expressions exercise 3 · mcq

Functions and expressions

Pick the idiomatic Rust function body. The last expression (with NO semicolon) is the function's return value — no return keyword needed.

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 ().