docs-v2/content/flux/v0/stdlib/universe/length.md

1.4 KiB

title description menu weight introduced
length() function `length()` returns the number of elements in an array.
flux_v0_ref
name parent identifier
length universe universe/length
101 0.7.0

length() returns the number of elements in an array.

Function type signature
(<-arr: [A]) => int

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

arr

Array to evaluate. Default is the piped-forward array (<-).

Examples

Return the length of an array

people = ["John", "Jane", "Abed"]

people |> length()// Returns 3