Skip to end of metadata
Go to start of metadata

Cprime Apps has been rebranded as Anova Apps. Please note the only effect is the company name - all of our products’ names, logos, functionalities, support, etc. is exactly the same. The new location to our documentation space is https://anovaapps.atlassian.net.

Availability

This routine is available starting with SIL Engine™ 1.0.

Syntax

arrayAddElement(arrayName, elem)

Description

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

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

Example

Example 1

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

watchers = addElement(watchers, currentUser());

The result returned by the routine 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 routine returns error.

SIL Engine™ 2.5 specific

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

There is no content with the specified labels

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))