Multiple foreach loop variables
This is one of my favorite features. The foreach command supports multiple loop variables and multiple value lists. This means that you can assign values to multiple variables during each loop iteration. The values can come from the same list or from lists that are processed in parallel. Multiple foreach loop variables are described on page 81. For example, you can iterate through the contents of an array with:
foreach {name value} [array get arrName] {
# arrName($name) is $value
}
 |