NAME
        foreach - do something for each member of an array or mapping.

SYNOPSYS
        foreach(<type> element: array) <code>;
        foreach(<type> element: array) { <code>; ... }

        foreach(<type> key, <type> value: mapping) <code>;
        foreach(<type> key, <type> value: mapping) { <code>; ... }

DESCRIPTION
        This is a compact way of doing a for-loop on all elements of an array
        or each combination of key and value of a mapping.

        For arrays, the execution is in the order of the array. Note that for
        mappings the order is unknown. The indices have no order.

        The standard loop control statements break and continue can be used.
        Loop statements may be nested.

ARGUMENTS
        <type> - the type of the variable used to designate the elements in
                 the array or mapping, e.g. int, string, or mixed.
        <code> - a line of code that is executed for each element. Note that
                 without the { } the <code> may only be a single statement.

EXAMPLES
        object *enemies;
        foreach (object enemy: enemies)
        {
            this_player()->make_peace(enemy);
        }

        The next two statements are identical in their execution:

        for (index = 0; index < sizeof(names); index++) write(names[index]);
        foreach(string name: names) write(name);

        mapping age_map = ([ "fatty" : 100, "nick" : 150 ]);
        foreach (string name, int age: age_map) { ... }

SEE ALSO
        break, continue, for, map, while
