For Each value...Next
Command Description
Sequentially obtain (also known as traverse) each element in an array or dictionary, and execute the following block of statements separately for the value of each obtained element.
Command Prototype
For Each value In dataStruct
Next
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
value | True | id | value | Traverse value |
dataStruct | True | expression | arrayRet | The data structure to be traversed |
Demo
TracePrint("------------------------------------ Traverse the array--------- ----------------------------------")
//-------------------------------------------------------------------------------
//[Remarks] Loop through each piece of data in Collection , substitute the name of the data (when corresponding to a dictionary) or index (when corresponding to an array) into key, substitute the value of the data into value and execute the Block statement block .
TracePrint("Let the array a = ['U','i','B','o','T'], traverse and print each value")
a = ['U','i','B','o','T']
For Each value In a
TracePrint value
Next