count()
Counts the elements of a value.
Signature
count(value)
Parameters
Ordinary collections or modules, text, range, or packed value.
Returns
Integer count, using u64 when the count exceeds i64. Text counts scalars, records count fields, and packed arrays count elements.
Behavior
Reads the value without mutation.
Errors
Unsupported value or invalid packed view.
Example
assert(count('é🐈') == 2 and count(2..5) == 3)