return
return ?-code code? ?-errorcode list? ?-level n? ?-options dict? ?value?
Ends the proc and gives the value as its result. -code error gives an error to the caller with the value as its message. -code break and -code continue stop a loop of the caller.
Examples
A click on an example runs it in the shell of the page.
proc check {n} {if {$n < 0} {return -code error -errorcode {NEG} "negative"}; return ok}; check 1:ok
Errors
check -1gives the errornegative
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.