Difference between revisions of "Len"
Jump to navigation
Jump to search
(Created page with "<c>len</c> is a intrinsic function that returns the number of elements in a list, the number of characters in a string, or the number...") |
m |
||
Line 1: | Line 1: | ||
− | <c>len</c> is | + | <c>len</c> is an [[:Category:Intrinsic Functions|intrinsic function]] that returns the number of elements in a [[list]], the number of characters in a [[string]], or the number of key/value pairs in a [[map]]. |
Revision as of 01:39, 21 February 2020
len
is an intrinsic function that returns the number of elements in a list, the number of characters in a string, or the number of key/value pairs in a map.
Arguments
Parameter Name | Default Value | Meaning |
---|---|---|
self | sequence or map to calculate the length of |
Usage Notes
len
may be called either as a global method, passing the sequence or map as an argument; or as a member function (defined on list, string, and map) using dot syntax, with no arguments.
If called with something other than a list, string, or map, len
returns null.
Example
x = ["a", "b", "c"]
print x.len // prints: 3