Variables

Declaration and Initialization

Variables are declared using the let keyword, followed by the variable name, a colon :, the type, and an optional initializer.

let variableName: Type = initialValue;

Examples:

let count: uint256 = 10;
let name: string = "Alice";

Variables can also be declared without an initial value:

let totalSupply: uint256;
totalSupply = 1000000;

Last updated