Skip to main content


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 key, value In dataStruct


Parameter Description

keyTrueidkeyTraversal Key
valueTrueidvalueTraverse value
dataStructTrueexpressiondictVarThe data structure to be traversed


TracePrint("------------------------------------ Traverse the dictionary--------- ----------------------------------") 
//[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 dictionary be a = {'a':'U','b':'i','c':'B','d':'o','e':'T' }, traverse and print each key, value")
a = {'a':'U','b':'i','c':'B','d':'o','e':'T'}
For Each key,value In a
TracePrint "key value: "&key&" value value: "&value