ResetMap

Map command

Syntax

Moves the cursor of a map before its first entry, so that the next NextMapElement() goes to the first entry.

ResetMap(<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 ResetMap, there is no current entry: reading m() stops the program with "BASIC map has no current element".
  • FOREACH calls it for you. Use ResetMap with a WHILE NextMapElement(m()) loop.

Example

NewMap m.s()m("x") = "1"m("y") = "2"ResetMap(m())WHILE NextMapElement(m())  Console(MapKey(m()) + "=" + m())   ' x=1, y=2WEND
In the manual : Arrays, lists and maps