LET

Function

LET assigns a value to a variable.

Syntax

LET variable name = numerical expression
LET string variable = string expression

Examples

LET C = 5
LET D3 = B
LET J = SIN(X)
LET A$ = "HELLO"
LET A$ = B$ '(see note)

Use of LET in an assignment statement is optional. The formats:

C = 5
D3 = B
J = SIN(X)
A$ = "HELLO"
A$ = B$ '(see notes below)

are equally acceptable.

Remarks

When equating string arrays of unequal length the string array on the right side of the equates will be truncated on the left side.

Example:

DIM A$(1,5)
A$ = "HELLO"
B$ = "GOODBYE"
A$ = B$

then A$ = “GOODB”

Note

Remember that string lengths default to 20 characters. In the above example, A$ should be DIMed to 5 character length as shown.

Strings can be created by multiple additions.

Example:

A$ = A$ + MID$(C$,4,3)+CHR$(65)

String expressions can also be created from complex string expressions of up to 10 functions. The derivation of the function requires the creation of an expression stack which can handle a maximum of ten functions. If the stack is exceeded a ‘string complexity’ error will result.

Example:

A$ = LEFT$(RIGHT$(MID$(A$,3,N),A),B)