home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcl2-73c.zip / tcl7.3 / doc / if.n < prev    next >
Text File  |  1993-05-03  |  3KB  |  59 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" All rights reserved.
  4. '\"
  5. '\" Permission is hereby granted, without written agreement and without
  6. '\" license or royalty fees, to use, copy, modify, and distribute this
  7. '\" documentation for any purpose, provided that the above copyright
  8. '\" notice and the following two paragraphs appear in all copies.
  9. '\"
  10. '\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
  11. '\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  12. '\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  13. '\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. '\"
  15. '\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  16. '\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  17. '\" AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  18. '\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  19. '\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. '\" 
  21. '\" $Header: /user6/ouster/tcl/man/RCS/if.n,v 1.1 93/05/03 17:34:01 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS if tcl
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. if \- Execute scripts conditionally
  29. .SH SYNOPSIS
  30. \fBif \fIexpr1 \fR?\fBthen\fR? \fIbody1 \fBelseif \fIexpr2 \fR?\fBthen\fR? \fIbody2\fR \fBelseif\fR ... \fR?\fBelse\fR? ?\fIbodyN\fR?
  31. .BE
  32.  
  33. .SH DESCRIPTION
  34. .PP
  35. The \fIif\fR command evaluates \fIexpr1\fR as an expression (in the
  36. same way that \fBexpr\fR evaluates its argument).  The value of the
  37. expression must be a boolean
  38. .VS
  39. (a numeric value, where 0 is false and
  40. anything is true, or a string value such as \fBtrue\fR or \fByes\fR
  41. for true and \fBfalse\fR or \fBno\fR for false);
  42. .VE
  43. if it is true then \fIbody1\fR is executed by passing it to the
  44. Tcl interpreter.
  45. Otherwise \fIexpr2\fR is evaluated as an expression and if it is true
  46. then \fBbody2\fR is executed, and so on.
  47. If none of the expressions evaluates to true then \fIbodyN\fR is
  48. executed.
  49. The \fBthen\fR and \fBelse\fR arguments are optional
  50. ``noise words'' to make the command easier to read.
  51. There may be any number of \fBelseif\fR clauses, including zero.
  52. \fIBodyN\fR may also be omitted as long as \fBelse\fR is omitted too.
  53. The return value from the command is the result of the body script
  54. that was executed, or an empty string
  55. if none of the expressions was non-zero and there was no \fIbodyN\fR.
  56.  
  57. .SH KEYWORDS
  58. boolean, conditional, else, false, if, true
  59.