Statements
dwarf, like Rust uses only a handful statements.
Let Statement
The let
statement is used to assign a value to a variable.
#fn main() { let x = 42; }
Expression Statement
Result Statement
#fn main() { fn empty() -> () { 42; } fn value() -> int { 42 } print(empty()); print(value()); print({}); print({42}); }
Item Statement
fn main() -> () { // This is aa item statement. // Note the lack of a semicolon. struct Point { x: float, y: float, } // This is also an item statement. fn foo() -> Point { Point { x: 42.0, y: -3.14 } } // Technically this is a statement, but `print` is an expression. print(foo()); }