Function: number_of_items

Function: number_of_items


 number_of_items(in: some_collection)

Returns the number of items in a list or the number of characters in a string.

Note: This function is exactly the same as length.


Parameter Type Description
in list or map or set or string Object to determine the number of items of. When it is a set, returns the number of cards. When it is a string, returns the number of characters.
filter function (optional) Act as if the list was filtered by this criterion. Only when in is a set.


 number_of_items(in: ["x", "y", "z"]) == 3
 number_of_items(in: "pink") == 4
 number_of_items(in: set) == # number of cards in the set

 # the number of red cards in the set
 number_of_items(in: set, filter: { card.color == "red" } )

See also

length Return the number of items in a list.
sort_list Sort a list.
filter_list Filter a list, keeping only elements that match a predicate.