Skip to main content
Version: v6.5.0

Enumerate

Command Description

Traverse the contents of a specified array or dictionary and convert them into an index sequence, i.e. a two-dimensional array; Each element in this two-dimensional array is a one-dimensional array in [key, value] format, listing both the data index and the data. When applied to the array to be converted, each key is a self increasing integer starting from the specified index, such as a=[1,2,3,4,5], Enumeration (a, 1), and the result output is [[1,1], [2,2] [3,3] [4,4] [5,5]]; When applied to the dictionary to be converted, the index start value attribute is invalid (no input is supported). Each key is a key in the dictionary, such as d = {"one":1, "two":2, "three":3, "four":4, "five":5} Enumerate(d) The result output is [["one", 1], ["two", 2], ["three", 3], ["four", 4], ["five", 5], and the internal order may not be consistent

Command Prototype

enum_result = Enumerate(obj, numStart)

Command parameter

parametermandatorytypedefault valueInstructions
objTrueexpression$ PrevResultThe data to be converted. Only supports array or dictionary types
numStartTruenumberoneIndex begins. Only valid for the array to be converted, specify the index start value for the converted index sequence, default to 1, and increment by integer; When the data to be converted is a dictionary, the current attribute is invalid (no input is supported), and the key in the dictionary to be converted is used as the index

Return result

Enum_result, Assign the result of the command execution to this variable.

Run instance

/**************************Enumerate**************************
Command prototype:
enum_result = Enumerate(obj, numStart)
Input parameters:
obj -- The data to be converted, only supporting array or dictionary types.
numStart -- The index start. Only valid for the array to be converted. It specifies the starting value of the index for the converted index sequence, defaulting to 1 and incrementing by integer. When the data to be converted is a dictionary, this attribute is invalid (no need to input), and the key in the dictionary to be converted is used as the index.
Output parameters:
enum_result -- The variable where the output of the function call is saved.
Notes:
None
******************************************************************/

Dim enum_result = ""
enum_result = Enumerate([1,2,3,4,5] , 1)
TracePrint(enum_result)

//[[1,1],[2,2][3,3][4,4][5,5]]