Skip to main content

Read-Each-Element-of-the-Array--and-Operate-the-Element-in-Turn

Command Description

Loop through every item in the collection and execute the statements in the block after the item name(corresponding to dictionary) or index(corresponding to array) is entered as key and the item value is entered as value

Command Prototype

For Each value In dataStruct

Next

Parameter Description

ParameterRequiredTypeDefaultDescription
valueTrueidvalueTraverse value
dataStructTrueexpressionarrayRetThe 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