PushMapPosition()
语法
PushMapPosition(Map())概要
Remembers the current element (if any) of the map so it can later be restored using PopMapPosition(). The position is remembered on a stack structure, so multiple calls to this function are possible.
参数
Map() The map to use.
返回值
无.
Remarks
This function can be used to remember the current element, so an iteration can be made over the map using NextMapElement() or ForEach and the current element can be restored after the iteration using PopMapPosition(). Multiple calls can be made to this function, as long as each is balanced with a corresponding PopMapPosition() call later.
Note: It is not allowed to delete an element that is a remembered current element using the DeleteMapElement() or ClearMap() function. This may result in a crash when PopMapPosition() is called because the elements memory is no longer valid.
示例
NewMap Numbers() Numbers("A") = 1 Numbers("B") = 2 Numbers("C") = 5 Numbers("D") = 3 Numbers("E") = 2 Numbers("F") = 5 ; A simple duplicate elimination using a nested iteration ; ForEach Numbers() Value = Numbers() PushMapPosition(Numbers()) While NextMapElement(Numbers()) If Numbers() = Value DeleteMapElement(Numbers()) EndIf Wend PopMapPosition(Numbers()) Next ForEach Numbers() Debug Numbers() Next
参阅
PopMapPosition(), FindMapElement(), NextMapElement(), ResetMap(), ForEach
已支持操作系统
所有