ARRAY::CONTAIN
1g 2024-01-04 laplante@plcb.ca GOWEB/ARRAY — Check Array Membershiptitle: “ARRAY::CONTAIN” version: “1g” date: 2024-01-04 author: “laplante@plcb.ca”
array::contain Check Array Membership
array::contain(array, expression[, error: variable, strict: bool, index: bool])
The contain
function checks whether a given expression exists in an array.
strict (default: false
)
If true
, the element must be of the same type as the array elements.
If false
, type coercion is allowed.
index (default: false
)
If true
, the function returns the first index of the element in the array.
If not found, returns -1
.
If false
, the function returns a boolean (true
/false
).
error
Variable to store an error if one occurs.
res={{
contain([1,2,3], 1);
contain([1,2,3], "1");
contain([[1,2],2,3], 1);
contain([[1,2],2,3], [1,2]);
}}.
Returns:
truetruefalsetrue
laplante@plcb.ca