Enumerator

Auto Hotkey

Enumerator Object

Allows items in a collection to be enumerated.

Next

Retrieves the next item or items in an enumeration.

Enum.Next(OutputVar1 , OutputVar2, ...)
OutputVar1, OutputVar2Receives an implementation-specific value.
...Additional parameters, if supported.
ReturnsA non-zero integer if successful, zero if there were no items remaining, or an empty string if parameters were incorrect.

Object

Enumerators returned by ObjNewEnum are called once for each key-value pair, and allow up to two parameters:

OutputVar1Receives the key in a key-value pair.
OutputVar2Receives the value associated with OutputVar1.

Key-value pairs are returned in an implementation-defined order. That is, they are typically not returned in the same order that they were assigned. Existing key-value pairs may be modified during enumeration, but inserting or removing keys may cause some items to be enumerated multiple times or not at all.

Related

For-loop, Object._NewEnum

Example

; Create some sample data.
obj := Object("red", 0xFF0000, "blue", 0x0000FF, "green", 0x00FF00)

; Enumerate!
enum := obj._NewEnum()
While enum[k, v]
    t .= k "=" v "`n"
MsgBox % t

; or simply:
For k, v in obj
    s .= k "=" v "`n"
MsgBox % s