Added January 2018
{LET} <variable> = <expression>
Assignment statements assign values to variables. The LET keyword is a holdover from ancient versions of BASIC and is normally omitted. <variable> can be any scalar variable or an array element. <expression> can be any expression compatible or convertible to the type of the specified variable; see Operators. Examples:
TOTAL = (QTY * PRICE) USING "######.##"
today$ = odtim(0,0,0)
month(m) = "December"
Price = Fn'Get'Price(sku)
$capitol("California") = "Sacramento"
ATE'SUPP = FLAGS and AGF_ATE
IS'BOY = GENDER$ = "M"
In all cases the assignment operator is the first "=" following the variable. Any other equal signs, as in the last example above, would be treated as comparison operators, resulting in a logical expression returning TRUE (-1) or FALSE (0).
In some cases where the first operand is the same as the variable being assigned, you can use a shortcut syntax; see Shortcut OperatorsShortcut Operators. Example:
GRAND'TOTAL += LINE'TOTAL ! same as GRAND'TOTAL = GRAND'TOTAL + LINE'TOTAL
FLAGS |= MBF_KBD ! same as FLAGS = FLAGS or MBF_KBD
MAP Statements may also contain implicit assignment statements by appending the value after the size parameter, e.g.
MAP1 PI, F, 6, 3.14159
The above would be the equivalent of:
MAP1 PI, F, 6
PI = 3.14159
See Also
Subtopics