APPEND¶
Description¶
APPEND returns a new list with a single element added to the end.
Unlike CONCAT, which merges two lists together, APPEND takes an existing list and a
single value and returns a new list containing all original elements followed by that value.
The original list is not mutated.
Syntax¶
Returns: A new list with element appended.
Example¶
This returns ['a', 'b', 'c', 'd'].
Difference from CONCAT¶
CONCAT merges two lists:
Returns ['a', 'b', 'c', 'd'].
APPEND adds a single element, not a list:
Returns ['a', 'b', 'c'].
If you pass a list as the element to APPEND, it will be added as a nested list, not merged:
Returns ['a', 'b', ['c', 'd']].
Appending an occurrence to a structure¶
In an assignment, APPEND adds one occurrence to a structure field when the element
is a dictionary: