Documentation Comments
Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.
Reality V15.0 ()
Assignments (DataBasic) (m618702+assignments.htm)
The simple assignment statement assigns a value to a variable.
{LET }variable = expression
where:
variablewhere the result of expression is to be stored.
expressionis any valid DataBasic expression.
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.
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.