ProvideX V8.20 > Language Reference > 2. Directives
172
LET Directive
             Assign Value to Variable
Format
[LET] var[$]=expression,[var[$]=expression,...]
Where:
var
Numeric or string variable to be set to the value of the expression.
expression
Numeric or string expression whose value will be assigned to the
variable.
Description
Use the LET directive to set a variable to the value of an expression. If the variable is
numeric, use a numeric expression. If it is a string variable, use a string expression.
You can use substrings with string variables. (Specify the starting position and
optional length.)
The word L E T is optional in Command mode. ProvideX assumes use of the LET
directive when it encounters a directive starting with a variable. You can include
multiple LET directives in one statement by using comma delimiters. In this case, if
you use the word L E T, it only occurs once, before the first assignment.
You can initialize, copy, or manipulate a complete array by specifying {ALL}
following the variable name. {ALL} can be used on both sides of an equation. Note
that the curly brackets { } are part of the syntax.
Examples
0080 LET A$="THIS IS AN EXAMPLE"
0100 A$(1,4)="WHAT",A$(19)="!",Z$=""
0110 A$(5,4)=Z$
If Z$ is more than 4 characters, A$(5,4) is set as the first 4 characters of Z$. If Z$ is
less than 4 characters, the A$(5,4) value is Z$ plus space-padding up to a length of
4 characters:
RUN
-:?A$
WHAT
AN EXAMPLE!
Other Examples:
-: Z4=A+4.5,Z5=Z4*.85
-: LET D$=DAY,T=TIM*3600
-: DIM A[30]; LET A{ALL}=A{ALL}*4