Purpose |
Assign a value to a variable. | ||||||||||||||||||||||
Syntax |
[LET] variable
= expression | ||||||||||||||||||||||
Remarks |
Simple assignment variable
is a
The word LET is optional in assignment statements. It is allowed to provide compatibility BASIC source files written for early versions of BASIC. In practice, the word LET is very rarely used. To allow easy conversion, PowerBASIC allows a User-Defined Type in a string expression. The User-Defined Type is simply copied, byte for byte, into the expression. However, to assign a string back to a User-Defined Type, you should use the TYPE SET statement. DIM abc as MyType Please refer to the following sections of the LET statement for special information regarding assignment using Object variables, Variant variables, and User-Defined Type variables. Compound assignment A compound assignment statement combines a binary
arithmetic operator, a binary
Compound assignments are available for the standard arithmetic operations of add, subtract, multiply, divide, int-divide, and modulo (+ - * / \ MOD), the bitwise operations (AND, OR, XOR, EQV, IMP), and the concatenation operators (+ &). Each are represented by one of the following tokens:
Each of the following pairs of code are functionally identical:
| ||||||||||||||||||||||
See also |
BUILD$, JOIN$, LET (with Objects), LET (with Variants), LET (with Types), TYPE SET | ||||||||||||||||||||||
Example |
MyString$ = "This is a test." |