Enumerator Object [AHK_L 49+]

Allows items in a collection to be enumerated.

Next

Retrieves the next item or items in an enumeration.

Boolean := Enum.Next(OutputVar1 , OutputVar2, ...)

Parameters

OutputVar1, OutputVar2
Receives an implementation-specific value.
...
Additional parameters, if supported.

Return Value

This method returns 1 (true) if successful or 0 (false) if there were no items remaining.

Object

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

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.

For-loop, Object.NewEnum()

Examples

; 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

; Requires [AHK_L 59+]
For k, v in obj
    s .= k "=" v "`n"
MsgBox % s