return
Return from a procedure with a value or special control flow.
Syntax
tcl
return ?options? ?value?Parameters
- value: The value to return. Defaults to empty string.
Options
- -code code: Return code. Can be:
ok(0) - Normal returnerror(1) - Raise an errorreturn(2) - Cause calling proc to returnbreak(3) - Break from loop in callercontinue(4) - Continue loop in caller- Or any integer
- -level level: Number of stack levels to return through
- -options dict: Dictionary of return options
Examples
Basic return
Output
Early return
Output
Return without value
Output
Returning from nested procedures
Output
Return with error code
Output
