Expression Statements
An expression statement is any Ad Astra expression that ends with a semicolon (;
).
(10 + 20) * (30 + foo(40));
Note that, unlike in Rust, Ad Astra statements are not expressions. The following
syntax is not allowed: return match x { 10 => true, else => false};
.
Variable Initialization Statement
The engine interprets the <variable_name> = <expr>;
assignment syntax as a
special expression statement that initializes the variable if it is not yet
initialized. Otherwise, it treats this expression as a standard assignment
operation.
Note that you cannot initialize uninitialized variables in any other way. Inner assignment expressions will also be interpreted as assignment operations.
let x;
// This will not initialize variable x:
// foo(x = 10);
// But this expression is an initialization expression.
x = 10;