home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / tcl_447.lzh / TCL / tcl.lzh / tcl / help / case < prev    next >
Text File  |  1990-05-03  |  1KB  |  26 lines

  1.  case string [in] patList body patList body ...
  2.       Match string against each of the patList arguments in 
  3.       order.  If one matches, then evaluate the following 
  4.       body argument by passing it recursively to the Tcl 
  5.       interpreter, and return the result of that evaluation. 
  6.       Each patList argument consists of a single pattern or 
  7.       list of patterns.  Each pattern may contain any of the 
  8.       wild-cards described under string match.  If a patList 
  9.       argument is default, the corresponding body will be 
  10.       evaluated if no patList matches string. If no patList 
  11.       argument matches string and no default is given, then 
  12.       the case command returns an empty string.  For example, 
  13.  
  14.       case abc in {a b} {format 1} default {format 2} a* {format 3}
  15.  
  16.       will return 3,      
  17.  
  18.       case a in {a b} {format 1} default {format 2} a* {format 3}
  19.  
  20.       will return 1, and     
  21.  
  22.       case xyz {a b} {format 1} default {format 2} a* {format 3}
  23.  
  24.       will return 2.      
  25.  
  26.