1mNAME0m
       return - Return from a procedure

1mSYNOPSIS0m
       1mreturn 22m?1m-code 4m22mcode24m? ?1m-errorinfo 4m22minfo24m? ?1m-errorcode 4m22mcode24m? ?4mstring24m?


1mDESCRIPTION0m
       Return  immediately from the current procedure (or top-level command or
       1msource 22mcommand), with 4mstring24m as the return value.   If  4mstring24m  is  not
       specified then an empty string will be returned as result.


1mEXCEPTIONAL RETURNS0m
       In  the usual case where the 1m-code 22moption isn't specified the procedure
       will return normally (its completion code will  be  TCL_OK).   However,
       the 1m-code 22moption may be used to generate an exceptional return from the
       procedure.  4mCode24m may have any of the following values:

       1mok        22mNormal return:  same as if the option is omitted.

       1merror     22mError return: same as if the 1merror 22mcommand were used to  ter-
                 minate  the  procedure,  except for handling of 1merrorInfo 22mand
                 1merrorCode 22mvariables (see below).

       1mreturn    22mThe current procedure will return with a completion  code  of
                 TCL_RETURN, so that the procedure that invoked it will return
                 also.

       1mbreak     22mThe current procedure will return with a completion  code  of
                 TCL_BREAK,  which will terminate the innermost nested loop in
                 the code that invoked the current procedure.

       1mcontinue  22mThe current procedure will return with a completion  code  of
                 TCL_CONTINUE,  which  will terminate the current iteration of
                 the innermost nested loop in the code that invoked  the  cur-
                 rent procedure.

       4mvalue24m     4mValue24m must be an integer;  it will be returned as the comple-
                 tion code for the current procedure.

       The 1m-code 22moption is rarely used.  It is  provided  so  that  procedures
       that  implement  new  control structures can reflect exceptional condi-
       tions back to their callers.

       Two additional options, 1m-errorinfo 22mand 1m-errorcode22m, may be used to  pro-
       vide  additional  information  during error returns.  These options are
       ignored unless 4mcode24m is 1merror22m.

       The 1m-errorinfo 22moption specifies an initial stack trace for  the  1merror-0m
       1mInfo  22mvariable;   if  it  is not specified then the stack trace left in
       1merrorInfo 22mwill include the call to the procedure and higher  levels  on
       the  stack but it will not include any information about the context of
       the error within the procedure.  Typically the 4minfo24m value  is  supplied
       from the value left in 1merrorInfo 22mafter a 1mcatch 22mcommand trapped an error
       within the procedure.

       If the 1m-errorcode 22moption is specified then 4mcode24m provides  a  value  for
       the  1merrorCode 22mvariable.  If the option is not specified then 1merrorCode0m
       will default to 1mNONE22m.


1mSEE ALSO0m
       break(n), continue(n), error(n), proc(n)


1mKEYWORDS0m
