Button handy |
---|
blank | true |
---|
color | #0052CC |
---|
name | Send Feedback |
---|
link | https://docs.google.com/forms/d/e/1FAIpQLScmToBe3vynAlb5fdKwCGxYqnTbDc66sIBgeecG2BuFDuHc7g/viewform?entry.2002826954=arrayAddElement+-+15480932 |
---|
width | auto |
---|
|
Table plus |
---|
applyColStyleToCell | true |
---|
heading | 0 |
---|
columnTypes | s,s,s,s |
---|
multiple | false |
---|
columnAttributes | style="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold, |
---|
enableSorting | false |
---|
|
Syntax | arrayAddElement(arrayName, elem) | Package | array | Alias | addElement(arrayName, elem) | Pkg Usage | addElement(arrayName, elem) | |
Description
Excerpt |
---|
|
If elem is an element of the array type, returns a new array that includes the specified element at the end. |
If elem is an element of the array type, returns a new array that includes the specified element at the end.
...
Table plus |
---|
applyColStyleToCell | true |
---|
columnTypes | s,s,s,s |
---|
heading | 0 |
---|
multiple | false |
---|
enableSorting | false |
---|
|
Parameter name | Type | Required | Description |
---|
arrayName | Array | Yes | Array the new element is added to. | elem | Any | Yes | Element to be added. Must be the same type as the array type. | |
Return Type
Array
Examples
Example 1
Code Block |
---|
|
watchers2 = addElement(watchers, currentUser()); |
The result returned by the routine function is assigned to a new array watchers2, so the initial array watchers will not be modified.
Example 2
Code Block |
---|
|
watchers = addElement(watchers, currentUser()); |
The result returned by the routine function is assigned to the same array watchers, so the initial array watchers will be modified.
Note |
---|
If elem is not the same type as declared in the array definition, the |
...
Info |
---|
Starting with version 2.5 is easier for you to just use the '+' operator to add elements to an array. array = array + element it is a simple and more meaningful way to express it. array += element is even better. |
See also
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 25 |
---|
showSpace | false |
---|
cql | label = "array_routine" and space = currentSpace ( ) |
---|
labels | array_routines |
---|
|