LET – variable assignment
Variable Assignment
This directive is used to assign a value to a string or numeric variable.
Syntax
Section titled “Syntax”[LET] variable-name = valueLET- is optional syntax that appears in the program listing.
variable-name- is the name of a specific numeric or string variable.
value- is any valid expression whose value is assigned to the specified variable.
Remarks
Section titled “Remarks”Numeric variable-names that are assigned values using a numeric constant retain the full numeric constant value regardless of the current setting of PRECISION. If value is a numeric expression rather than a numeric constant, the numeric variable-name receives a value that is rounded to the current PRECISION.
String variable-names have the same length as value after the LET directive, regardless of what length the string variable-name had before the LET directive was executed.
Multiple assignments can be made if separated by commas.
Starting with release level 8.2 a colon is now allowed to immediately following the ‘=’ to substitute the left side of the ‘=’ for the colon. For example: LET ABC$[2]=:+ “X” becomes: LET ABC$[2]=ABC$[2]+ “X”. This is only a shorthand notation for input. The code still lists the expanded way.
Examples
Section titled “Examples”LET A = 6assigns the value 6 to the numeric variable.
A = 6has the same effect as the first example.
LET B$ = "TEMP"assigns the value “TEMP” to the string variable B$.
B$ = C$If C$ = “TEMP”, has the same effect as the preceding example.
LET B = 6 + T, G = T / 20If T=10, assigns 16 to B and .5 to G.
C$ = "A" + B$If B$ = “Z”, assigns C$ the value “AZ”.
From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF