LET Verb

Syntax

LET var=expr{,var=expr...}
LET strarray=strarray
LET numarray=arrayexpr{,numarray=arrayexpr...}

Description

For BBj-specific information, see LET Verb - BBj.

The LET verb assigns the value of the expression on the right of the equal sign to the variable on the left of the equal sign. More than one assignment can be made in a LET statement. If an error is retried, the entire statement is re-executed.

The word "LET" is optional. When the statement is listed, PRO/5 inserts "LET".

String Array Assignment

The following is an example of the second type of syntax form and displays the assignment of a string array. The original contents of the string array, A$, are lost and are replaced with the contents of the ARRAY$ string array.

LET A$[ALL]=ARRAY$[ALL]

Matrix Operations (numeric arrays)

Copy, add, subtract, multiply, and scalar multiply matrix operations are supported. Though there are three separate syntax forms, matrix expressions as well as normal expressions may be combined in the same LET. The following matrix operations are implemented: copy, add, subtract, multiply, and scalar multiply. Unless otherwise indicated, the same matrix may be used as both an operand and the result of the operation. If the resulting matrix is not also one of the operands, it will be automatically dimensioned by PRO/5. Matrix operations may be performed on integer arrays as well as regular numeric arrays, but mixed mode is not allowed.

Operation

Example

Description

Copy

LET A[ALL]=B[ALL]

Makes A[ALL] a copy of B[ALL].

Add

LET A%[ALL]=B%[ALL]+C%[ALL]

Adds the corresponding elements of matrices B and C. Both B and C must have identical dimensions. Useful for translations (moving around) of graphics objects.

Subtract

LET A[ALL]=B[ALL]-C[ALL]

Subtracts the corresponding elements of matrices B and C. Both B and C must have identical dimensions. Useful for translations (moving around) of graphics objects.

Multiply

LET A[ALL]=B[ALL]*C[ALL]

Performs a matrix multiply, as defined in the tradition of matrix algebra. NOTE: It does not simply multiply corresponding elements as does add and subtract. For a detailed explanation of this process please consult a textbook on linear algebra.

Useful for rotations of graphics objects as well as mapping a 3-dimensional plot to a 2-dimensional display. The matrices involved must conform to the following rules:

  • Both B and C must be 2-dimensional.

  • The second dimension of B must match the first dimension of C. For example, if B was an i by j matrix, then C must be a j by k matrix, and the resulting A matrix would be i by k.

  • The same matrix CANNOT appear on both sides of the "=".

Scalar Multiply

LET A[ALL]=B[ALL]* num

Multiplies each element in matrix B by the value of num. Used for scaling (changing the size) graphic objects.

Examples

1000 LET A=5
1010 LET A$="TEST",B$=C$,D=F/2+56^N

See Also

Verbs - Alphabetical Listing