objarray : foreach

objarray foreach <variable_name> <obj> <body>

Do a loop over all elements of the objarray, on each iteration set the value of <variable_name> to the i-value and evaluate the script of the body, similar to a for or a foreach Tcl command.

A break command in the body exit the loop

e.g.

set obj [objarray new intarray -values {5 6 7 8}] 
-> 5 6 7 8 
objarray foreach x $obj {
   puts "x=$x"
}
-> 
x=5
x=6
x=7
x=8