Assignments
The simple assignment statement assigns a value to a variable.
Syntax
{LET }variable = expression
where:
variablewhere the result of expression is to be stored.
expressionis any valid DataBasic expression.
Comments
The word LET is optional and is implied by the = sign. It is therefore omitted from any examples. You can, however, include it if you wish to enhance readability.
The debugger displays a runtime error message if a variable is referenced before it has been assigned a value.
Examples
ABC = 500
assigns the value 500 to variable ABC.
ABC = 500
X = (ABC + 100)/2
assigns the arithmetic expression (ABC + 100)/2, which evaluates to 300, to the variable X.
VALUE = "THIS IS A STRING"
assigns the string THIS IS A STRING to the variable VALUE.
SUB = VALUE[6,2]
performs the substring extraction, where VALUE = "THIS IS A STRING", and assigns the substring "IS" to variable SUB. Refer to the sections Substring Extraction and Substring Assignment.