home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcl2-73c.zip / tcl7.3 / doc / return.n < prev    next >
Text File  |  1993-08-03  |  4KB  |  105 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/return.n,v 1.8 93/08/03 16:15:41 ouster Exp $ SPRITE (Berkeley)
  22. '\" 
  23. .so man.macros
  24. .HS return tcl 7.0
  25. .BS
  26. '\" Note:  do not modify the .SH NAME line immediately below!
  27. .SH NAME
  28. return \- Return from a procedure
  29. .SH SYNOPSIS
  30. \fBreturn \fR?\fB\-code \fIcode\fR? ?\fB\-errorinfo \fIinfo\fR? ?\fB\-errorcode\fI code\fR? ?\fIstring\fR?
  31. .BE
  32.  
  33. .SH DESCRIPTION
  34. .PP
  35. Return immediately from the current procedure
  36. (or top-level command or \fBsource\fR command),
  37. with \fIstring\fR as the return value.  If \fIstring\fR is not specified then
  38. an empty string will be returned as result.
  39.  
  40. .SH "EXCEPTIONAL RETURNS"
  41. .PP
  42. In the usual case where the \fB\-code\fR option isn't
  43. .VS
  44. specified the procedure will return normally (its completion
  45. code will be TCL_OK).
  46. However, the \fB\-code\fR option may be used to generate an
  47. exceptional return from the procedure.
  48. \fICode\fR may have any of the following values:
  49. .TP 10
  50. \fBok\fR
  51. Normal return:  same as if the option is omitted.
  52. .TP 10
  53. \fBerror\fR
  54. Error return: same as if the \fBerror\fR command were used to
  55. terminate the procedure, except for handling of \fBerrorInfo\fR
  56. and \fBerrorCode\fR variables (see below).
  57. .TP 10
  58. \fBreturn\fR
  59. The current procedure will return with a completion code of
  60. TCL_RETURN, so that the procedure that invoked it will return
  61. also.
  62. .TP 10
  63. \fBbreak\fR
  64. The current procedure will return with a completion code of
  65. TCL_BREAK, which will terminate the innermost nested loop in
  66. the code that invoked the current procedure.
  67. .TP 10
  68. \fBcontinue\fR
  69. The current procedure will return with a completion code of
  70. TCL_CONTINUE, which will terminate the current iteration of
  71. the innermost nested loop in the code that invoked the current
  72. procedure.
  73. .TP 10
  74. \fIvalue\fR
  75. \fIValue\fR must be an integer;  it will be returned as the
  76. completion code for the current procedure.
  77. .LP
  78. The \fB\-code\fR option is rarely used.
  79. It is provided so that procedures that implement
  80. new control structures can reflect exceptional conditions back to
  81. their callers.
  82. .PP
  83. Two additional options, \fB\-errorinfo\fR and \fB\-errorcode\fR,
  84. may be used to provide additional information during error
  85. returns.
  86. These options are ignored unless \fIcode\fR is \fBerror\fR.
  87. .PP
  88. The \fB\-errorinfo\fR option specifies an initial stack
  89. trace for the \fBerrorInfo\fR variable;  if it is not specified then
  90. the stack trace left in \fBerrorInfo\fR will include the call to
  91. the procedure and higher levels on the stack but it will not include
  92. any information about the context of the error within the procedure.
  93. Typically the \fIinfo\fR value is supplied from the value left
  94. in \fBerrorInfo\fR after a \fBcatch\fR command trapped an error within
  95. the procedure.
  96. .PP
  97. If the \fB\-errorcode\fR option is specified then \fIcode\fR provides
  98. a value for the \fBerrorCode\fR variable.
  99. If the option is not specified then \fBerrorCode\fR will
  100. default to \fBNONE\fR.
  101. .VE
  102.  
  103. .SH KEYWORDS
  104. break, continue, error, procedure, return
  105.