for Loop - Table Form
for Loop - Table Form
for INDEX , VALUE in EXP1do BLOCK end
The table for statement traverses all pairs (INDEX, VALUE) of a given table. The behavior is undefined if you assign to INDEX inside the block, or if you change the table during the traversal. The variables INDEX and VALUE are local to the statement; you cannot use their values after the loop ends. If you need to use any value outside the loop, assign them to other variables before breaking.A break exits a for loop. Traversal order is undefined, even for numerical indices (to traverse indices in numerical order, use a numerical for.)