📄 return.n
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) return.n 1.13 96/08/26 13:00:12'\" .so man.macros.TH return n 7.0 Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEreturn \- Return from a procedure.SH SYNOPSIS\fBreturn \fR?\fB\-code \fIcode\fR? ?\fB\-errorinfo \fIinfo\fR? ?\fB\-errorcode\fI code\fR? ?\fIstring\fR?.BE.SH DESCRIPTION.PPReturn immediately from the current procedure(or top-level command or \fBsource\fR command),with \fIstring\fR as the return value. If \fIstring\fR is not specified thenan empty string will be returned as result..SH "EXCEPTIONAL RETURNS".PPIn the usual case where the \fB\-code\fR option isn'tspecified the procedure will return normally (its completioncode will be TCL_OK).However, the \fB\-code\fR option may be used to generate anexceptional return from the procedure.\fICode\fR may have any of the following values:.TP 10\fBok\fRNormal return: same as if the option is omitted..TP 10\fBerror\fRError return: same as if the \fBerror\fR command were used toterminate the procedure, except for handling of \fBerrorInfo\fRand \fBerrorCode\fR variables (see below)..TP 10\fBreturn\fRThe current procedure will return with a completion code ofTCL_RETURN, so that the procedure that invoked it will returnalso..TP 10\fBbreak\fRThe current procedure will return with a completion code ofTCL_BREAK, which will terminate the innermost nested loop inthe code that invoked the current procedure..TP 10\fBcontinue\fRThe current procedure will return with a completion code ofTCL_CONTINUE, which will terminate the current iteration ofthe innermost nested loop in the code that invoked the currentprocedure..TP 10\fIvalue\fR\fIValue\fR must be an integer; it will be returned as thecompletion code for the current procedure..LPThe \fB\-code\fR option is rarely used.It is provided so that procedures that implementnew control structures can reflect exceptional conditions back totheir callers..PPTwo additional options, \fB\-errorinfo\fR and \fB\-errorcode\fR,may be used to provide additional information during errorreturns.These options are ignored unless \fIcode\fR is \fBerror\fR..PPThe \fB\-errorinfo\fR option specifies an initial stacktrace for the \fBerrorInfo\fR variable; if it is not specified thenthe stack trace left in \fBerrorInfo\fR will include the call tothe procedure and higher levels on the stack but it will not includeany information about the context of the error within the procedure.Typically the \fIinfo\fR value is supplied from the value leftin \fBerrorInfo\fR after a \fBcatch\fR command trapped an error withinthe procedure..PPIf the \fB\-errorcode\fR option is specified then \fIcode\fR providesa value for the \fBerrorCode\fR variable.If the option is not specified then \fBerrorCode\fR willdefault to \fBNONE\fR..SH KEYWORDSbreak, continue, error, procedure, return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -