Availability
This routine is available since katl-commons 1.0 .
Syntax:
arrayElementExists(array, elem)
Description:
Returns true if the element exists in the array, false otherwise.Alias:
elementExists(array, elem)
Parameters:
Parameter name | Type | Required | Description |
---|---|---|---|
array | array | Yes | The array where the element existence is checked. |
element | any | Yes | The element whose existence is checked. |
Returns:
boolean
Example:
if( elementExists(watchers, currentUser()) ){ print("You are watching this issue."); }
The routine returns true if currentUser is in the watchers array and if the result is true a message is printed
Notes:
If elem is not the same type as declared in the array definition, the routine returns error.
See also: