Len

From MiniScript Wiki
Revision as of 20:56, 29 February 2020 by JoeStrout (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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