LET
Purpose | To assign the value of an expression to a variable |
Syntax | [LET] variable
= expression Important : a) When assigning a 16-bit variable to a 32-bit integer, only the lower 16 bits of the 32-bit integer will be assigned. Hence the programmer must take special care if the 32-bit number is out of the range of a 16-bit number (which is between -32768 to 32767). b) If a negative 16-bit number is assigned to 32-bit integer variable, then the sign bit will be extended to 32 bits. e.g. DM[1] = -123. The 16-bit hexadecimal value of -123 is &HFF85, but A will be assigned the hexadecimal value &HFFFFFF85. Their decimal representation are however the same. |
Examples | LET D = 11 A$ = "Welcome to TBASIC" |
Comments: | use of the LET keyword is optional: i.e. the equal sign is sufficient when assigning an expression to a variable name. The variable type on both sides of the equal side must be the same. i.e. string variable may not be assigned to a numeric expression and vice-versa. |
Basic to TBASIC Reference Manual