Statements

Expression Statements

An expression followed by a semicolon.

a = b + c;

Variable Declarations

As shown in the Variables section.

let x: uint256 = 5;

Control Flow Statements

If Statements

if (condition) {
    // Statements
} else {
    // Statements
}

Example:

if (balance > 0) {
    // Do something
} else {
    // Do something else
}

While Loops

Example:

For Loops

Example:

Last updated