Qu

len

Builtin index · Collections & strings

result = len(f)

Input: f · Output: result

What it is

f is a fifo handle.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = len(f)
f numbernot documented yet
result number
Returns a number: the current element count (via the same generic length dispatch every collection uses).

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

t = (0 to 999) / 1000
print("{len(t)} values, from {t[0]} to {t[999]}")
output
1000 values, from 0 to 0.999

from start-here

above = levels[levels > 1.0]
print("{len(above)} readings above 1.0, they are {above}")
output
3 readings above 1.0, they are [1.2, 2.1, 1.7]

from start-here

where = [10, 20, 30]
print(len(where))        # 3       <- the list is intact

print(where[0])          # []      <- no error, no warning

output
3
[]

from agent-guide

levels = [0.5, 1.2, 0.8, 2.1, 1.7]
count = 0
for k in 0 to len(levels) - 1
    if levels[k] > 1.0
        count = count + 1
    end if
end for
print("{count} readings above 1.0")
output
3 readings above 1.0

from start-here

See also

length, numel — documented in the same entry.