Blocks are expressions

A block evaluates its final expression. A trailing statement, or no expression at all, gives the block the void value. This lets a calculation keep temporary bindings close to the result.

Braces containing key: value entries are a dictionary. Empty {} is a block; write {:} for an empty dictionary.

fn main() {
  let answer = {
    let base = 40
    let extra = 2
    base + extra
  }
  println(answer)
}
Output & diagnostics
Expected:
42
Ctrl/⌘+Enter runs the current lesson.