foreach

Iteration command
Usage
foreach(<variable>,[<item>[,<item>[,<item>[...]]]) <command>
Description
Executed <command> while assigning to <variable> each <item>.
<item> may be a constant , a variable , an array , a dictionary or a function returning either a constant string an array reference or a dictionary reference.
If <item> is an array , a dictionary or a function that returns a dictionary or array reference the iteration is done through all the dictionary/array items.
Please note that the iteration order of dictionary items is undefined.
You can always break from the loop by using the break command.
Syntax Specification
foreach(<variable>,[<item>[,<item>[,<item>[...]]]) <command>
Examples
    foreach(%i,1,2,3,4,5,6,7,8,9)echo %i
    foreach(%chan,$window.list(channel))me -r=%chan This is a test!
    # This will work too, and will do the same job
    %windows[] = $window.list(channel)
    foreach(%chan,%windows[])me -r=%chan This is a test!
    # And this too
    %windows[] = $window.list(channel)
    foreach(%key,$keys(%windows[]))me -r=%windows[%key] This is a test!
    # Another interesting example
    alias(test){ return $hash(1,a,2,b,3,c,4,d); };
    foreach(%x,$keys($test)){ echo %x, $test{%x}; }

Index, Commands
KVIrc 3.2.2 Documentation
Generated by mcmeijer at Sun Jun 3 08:41:39 2007