Declaration
You start by declaring a variable with its type followed by you chosen name and a semicolon.Assignment
After declaring the variable, you can give - or assign - a value to it.Use
To retrieve the value, you simply refer to the variable name. To change (update) the value, you use another assign statement.Variable names
You can label variables almost anything you want.- Lower-case and upper-case letters a-z, numbers, and underscore.
- Names must be unique within their scope.
- Names can’t be any of the reserved words.
Variable types
The basic built-in data types are:- Bool
- Float
- Generic
- Integer
- String
Scope
Scope determines where you variable is visible and can be used. Most variables are local, meaning that they are available only within the block you declared them in. This lets you reuse variable names in multiple functions and blocks, such as the counteri in loops.
Variables declared outside any class, struct, or function are global. These are available to any other code in the current script.