NAME
foreach - the foreach statement
SYNTAX
foreach(variable, array)
statement
DESCRIPTION
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.
NOTE
Expect the unexpected...
EXAMPLE
void foo(mapping m)
{
mixed x;
foreach(x, m_indices(m))
{
write(sprintf("%O", x) +" : " + sprintf("%O", m[x]) + "\n");
}
}
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
Help topics available:
You are guest number 164 since November 2019.
This file was last modified: June 2000.