From the NannyMUD documentation
2000-12-16
foreach - The foreach statement.
foreach (variable, array) statement
Execute statement once for each element in 'array', setting
'variable' to one element of 'array' each time around.
A 'break' in the 'statement' will terminate the loop. A
'continue' will continue the execution from the beginning of
the loop with the next value.
void foo(mapping m)
{
mixed x;
foreach (x, m_indices(m))
{
write(sprintf("%O", x) +" : " + sprintf("%O", m[x]) + "\n");
}
}
This will print out the contents of the mapping passed to
function foo, one index : value on each line.
"foo(([1:2,3:4,5:6]));" would give the following output:
1 : 2
3 : 4
5 : 6