Rust theorytheory 0/50 · 0%
Fundamentals · easy

5. Functions and Expressions

Rust is an expression language.

Functions annotate parameter and return types. A block's final expression, written without a semicolon, is its value. `if`, `match`, blocks and `loop` are all expressions that can produce values.

Check your understanding

  1. 1. A trailing expression without a semicolon…

  2. 2. Is `if` an expression?