home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / help / 5_programming / fe < prev    next >
Encoding:
Text File  |  2002-10-28  |  2.2 KB  |  62 lines

  1. Synopsis:
  2.    fe (<list>) <variable> [<variable> ...] { <actions> }
  3.  
  4. Description:
  5.    FE is one of several loop types available in ircII-EPIC.  This loop
  6.    takes a list of items, and for each one, it performs the specified
  7.    action.
  8.  
  9.    It may act on more than one item at a time.  The list may be a plain
  10.    text list, a variable, a function, or any combination.  As with aliases
  11.    and other control structures, the braces surrounding the action may
  12.    appear anywhere.  List items are whitespace-delimited.  Extended words
  13.    (those with spaces in them) are honored when they are surrounded in
  14.    double quotes (").
  15.  
  16.    For instance, FE might be used to loop through a list of nicknames
  17.    that the user wishes to invite to a channel (or kick from it!).
  18.  
  19.    Any looping mechanism can run through a list one by one.  The real
  20.    power of FE is its ability to act on multiple list items at once.
  21.    One could perform an action on 3 at a time, for instance, such as
  22.    setting a +o channel mode on other users.  Other loops, such as FOR,
  23.    can do this as well, but FE offers a more elegant solution.
  24.  
  25. Examples:
  26.    A simple mode +o script to cluster mode changes 3 at a time:
  27.       fe ( $friends ) xx yy zz {
  28.          if ( zz ) {
  29.             mode #blah +ooo $xx $yy $zz
  30.          } {
  31.             if ( yy ) {
  32.                mode #blah +oo $xx $yy
  33.             } {
  34.                mode +o $xx
  35.             }
  36.          }
  37.       }
  38.  
  39.    A script to check for upper-case letters in a line of input:
  40.       @ caps = 0
  41.       fec ( $* ) xx {
  42.          if ( ascii($xx) >= 65 || ascii($xx) <= 90 ) {
  43.             @ caps++
  44.          }
  45.       }
  46.       echo *** Found $caps upper-case letters
  47.  
  48. Aliases:
  49.    FEC works the same as FE, except it loops through each character in the
  50.    list, not each word.  Whitespace is only valid if it is between two
  51.    other non-whitespace characters.  Whitespace that follows the opening
  52.    parenthesis, and that leads up to the closing one, is ignored.
  53.  
  54. See Also:
  55.    for(5); foreach(5); until(5); while(5)
  56.  
  57. Other Notes:
  58.    The loop doesn't necessarily have to have an action inside the curly
  59.    braces.  It doesn't make much sense to omit it, though. Since 01/22/97,
  60.    FE and FEC use local(6) variables instead of global.
  61.  
  62.