FreeMap

Map command

Syntax

Removes every entry of a map and frees it. A freed map cannot be used until it is declared again with NewMap.

FreeMap(<map>())

Parts

<map>The map, written with its empty parentheses: stock(). It must be a NewMap variable or a map field of a record.

Good to know

  • After FreeMap, MapSize() returns -1 and MapKey() returns "". Reading or writing an entry, or any other map call, stops the program with "BASIC map is not initialized".
  • A second FreeMap on the same map does nothing and raises no error.
  • To empty a map and keep using it, call ClearMap() instead.

Example

NewMap stock.i()stock("apple") = 3FreeMap(stock())Console(Str(MapSize(stock())))   ' -1NewMap stock.i()stock("pear") = 5Console(Str(MapSize(stock())))   ' 1
In the manual : Arrays, lists and maps