...
Info | ||
---|---|---|
| ||
This routine is available since starting with katl-commons 1.0 . |
Syntax
...
arrayAddElement(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. |
Alias
...
addElement(arrayName, elem)
Parameters
...
Parameter name | Type | Required | Description |
---|---|---|---|
arrayName | array | Yes | The array to which the new element is added |
elem | any | Yes | The element to be added. Must be the same type as the array type |
Return Type
...
array
Example
...
Example 1
...
Code Block |
---|
watchers2 = addElement(watchers, currentUser()); |
The result returned by the routine is assigned to a new array watchers2, so the initial array watchers will not be modified.
Example 2
...
Code Block |
---|
watchers = addElement(watchers, currentUser()); |
...
Info | ||
---|---|---|
| ||
Since Starting with version 2.5 version 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) | ||||||
---|---|---|---|---|---|---|
|
__________________________________________________________________________________________________________________________________________________