An array expression that contains an infix operator, array, and element results in an array with identical bounds, with each element reflecting the result of the operation performed on the original array element and the single element. For example:
Array A before operation | Operation | Array A after operation | ||||
---|---|---|---|---|---|---|
1 | 2 | -3 | A = A * 2 | 2 | 4 | -6 |
4 | 5 | 6 | 8 | 10 | 12 |
The element operand may be an element of the array:
Array A before operation | Operation | Array A after operation | ||||
---|---|---|---|---|---|---|
1 | 2 | -3 | A = A * A(1,3) | -3 | -6 | 9 |
4 | 5 | 6 | 36 | 45 | 54 |
In the preceding example, the element A(1,3) was -3 in the original array. When that element was operated on and resulted in 9, 9 was used in the operations on the rest of the array.