### A.2.2.5List Operators

The addition operator (+) and the subtraction operator (-) make it possible to add or subtract Lists respectively. When using these operators data type conversion can take place, e.g.,

```[1, 3, "January "] + [2, 5.0 j, 98]  // -> [3, 3.0 + 5.0 j, "January 98"]
[0.1, 0.5] + [-1, 2]                 // -> [-0.9, 2.5]
[7.8, 5.9] - [-1.3, 2.7]             // -> [9.1, 3.2]
```

Lists to be added or subtracted must have the same lengths and the same structure.

To select a specific element of a List the list subscripting operator ([]) can be used. The index number within the brackets must be an Integer.

The index of the first element of a List is 0.

If nested Lists are accessed the corresponding number of indices must be given to get a list element. If fewer indices are given a list will be returned. Some examples:

```a1 = [1, 2, 3, 4, 5];     // List with 8 elements
a2 = [[1, 2],
[3, 4]];            // 2x2 matrix
a3 = [[[1, 2],
[3, 4]],
[[5, 6],
[7, 8]]];          // 2x2x2 matrix
a1                     // -> 4
a1                     // -> ERROR! Index out of range.
a2                  // -> 2
a3               // -> 6
a3                  // -> [3, 4]
a3            // -> ERROR! Too many indices.
```

Robert Klima 2003-02-06