Lingo Dictionary > A-C > add |  |

add

Syntax

    linearList.add(value)
    add linearList, value

Description

List command; for linear lists only, adds the value specified by `value` to the linear list specified by `linearList`. For a sorted list, the value is placed in its proper order. For an unsorted list, the value is added to the end of the list.

This command returns an error when used on a property list.

Note: Don't confuse the `add` command with the `+` operator used for addition or the & operator used to concatenate strings.

Example

These statements add the value 2 to the list named `bids`. The resulting list is [3, 4, 1, 2].

    bids = [3, 4, 1]
    bids.add(2)

Example

This statement adds 2 to the sorted linear list [1, 4, 5]. The new item remains in alphanumeric order because the list is sorted.

    bids.add(2)

See also

`sort`