Syntax
Gives the number of entries in a map.
MapSize(<map>())Parts
| <map> | The map, written with its empty parentheses: stock(). It must be a NewMap variable or a map field of a record. |
|---|
Returns
The number of entries, or -1 after FreeMap().
Good to know
- Reading a missing key with
m("key")creates it, so it counts inMapSize. Test keys with FindMapElement().
Example
NewMap stock.i()Console(Str(MapSize(stock()))) ' 0stock("apple") = 3stock("pear") = 5stock("apple") = 4Console(Str(MapSize(stock()))) ' 2In the manual : Arrays, lists and maps