!	 $eterna: foreach,v 1.6 2002/08/29 10:24:12 mrg Exp $
!
! Copyright (c) 1990-2002  Michael Sandrof, Troy Rollo, Matthew Green,
! and other ircII contributors.
!
! All rights reserved.  See the HELP IRCII COPYRIGHT file for more
! information.
!
Usage: FOREACH <structure> <variable> { <commands> }
  This causes <commands> to be executed once for each 
  element in the structure.  The aliases inside the {} 
  are not expanded until execution unless the leading { 
  is quoted like \{
  Here are a couple examples of basic foreach commands.
    assign blue.1 one
    assign blue.2 two 
    assign blue.3 three
    foreach blue ii { echo $ii $blue[$ii] }
  will return
    1 one
    2 two
    3 three
  FOREACH can also be imbedded such as in the following example.
    assign blue.1.1 one one
    assign blue.1.2 one two
    assign blue.2.1 two one
    assign blue.2.2 two two
    alias showblue {
      foreach blue ii
      {
        foreach blue.$ii jj
        {
	  echo $ii $jj $blue[$ii][$jj]
        }
      }
    }
  And /showblue returns.. 
    1 1 one one
    1 2 one two 
    2 1 two one
    2 2 two two

Note:
  When using this format the {} in the foreach must be on separate 
  lines by themselves.  This is true for IF and WHILE as well.

  Notice that variable names 'ii' and 'jj' were used.  Any name can
  be used for the index but keep in mind that single letter vars can
  interfere with the built in single char vars.  See ALIAS special

See Also:
  expressions
  ALIAS special
