kcl-std → functions → count

countFunction in std::array

Find the number of elements in an array.

count(@array: [any]): number

Arguments

NameTypeDescriptionRequired
array[any]The array whose length will be returned.Yes

Returns

number - A number.

Examples

arr1 = [10, 20, 30]
assert(count(arr1), isEqualTo = 3)

Rendered example of count 0

Found a typo?