Language and Conventions Overview | Expressions
Array expressions provide a convenient method of performing addition or subtraction operations on arrays, or of setting one array equal to another. The arrays in the computation must be singly dimensioned and of the same size and type. Using an array expression is the same as performing the operation on each individual element of the array.
The following is an example of using an array expression.
NUMBER/A(3),B(3),C(3)
A(1) = 1
A(2) = 2
A(3) =
3
B(1) = 4
B(2) = 5
B(3) = 6
Add all of the previously defined variables in a single array expression. C(1), C(2), and C(3) would now be defined as variables.
C = A + B
Add all of the previously defined variables using individual operations.
C(1) = A(1) + B(1)
C(2) = A(2) + B(2)
C(3) = A(3) +
B(3)
Both of the methods shown above would result in the following values for the variable "C":
C(1) = 5, C(2) = 7, C(3) = 9
NOTE: Arrays may also be negated by using an array expression.