Skip to main content
Variables are the foundation of any Standard program. In Standard, a variable name can be any alphanumeric value as long as it does not start with a number or a special character, and it may not contain a special character anywhere in the name. Variable names are case-sensitive, so myName and myname are treated as two distinct variables. To set a variable to a value, write the variable name followed by whitespace and the value you want to assign:

Types

Standard automatically infers and sets the type of a variable based on the value you assign. Once a type is established, the variable must maintain that type throughout its lifetime. The following built-in types are supported:

Null Types and Initialization

You can set a variable to null by following the variable name with null. You can also declare a variable on its own line with no assigned value — Standard will automatically initialize it to null. The variable inherits a concrete type the first time you assign it a non-null value:
In the example above, username starts as null, receives its type when the user provides input, and is then printed to the console.

Reserved Words

Variable names may not be a reserved word or built-in function name. They also may not share a name with any function you define in your own Standard code. The following words are reserved and unavailable for use as variable names:
Using a reserved word as a variable name will cause an error at runtime. Choose descriptive names that don’t conflict with Standard’s built-in vocabulary.