Blocks and statements
Blocks ({ ... }) group statements and introduce a new scope.
Full reference: flow blocks statements.
Notes#
- Supported forms + syntax notes: flow blocks statements
Example: scope boundaries#
fn main () -> int {
let x: int = 1;
{
let y: int = 2;
if x + y != 3 {
return 1;
}
}
// `y` is not in scope here.
return 0;
}
See also#
- Full reference: flow blocks statements
- Expression statements: flow expression statements
Source repository · Edit this page · View Markdown