Variables
Syntax
var_stmt ::= attributes "var" identifier ((":" type_expr [":=" expression]) | (":=" expression))
Description
Memory locations with specific types are explicitly named as variables.variables. When values are assigned to variables, they are stored in the designated memory location for that variable. If a type cannot be converted and the variable is a class type that has an overloaded suitable operator, it will be converted using a custom operator defined by the programmer. Otherwise, an exception TR007 is thrown.
There are two types of variables:
- Variables declared outside of functions and within a module are referred to as global variables. They are accessible for the duration of the program's execution and are kept in the global context.
- Local variables are defined within a block of code, such as a function, class, or extension. Its stackframe stores their value.
Example
...