Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

return: -code and -level

43 views
Skip to first unread message

heinrichmartin

unread,
May 11, 2018, 8:59:46 AM5/11/18
to
Hi,
another question that is rather out of curiosity than relevant for a real problem - is the following observation correct?

"[return -code ok -level ${n+1}] behaves exactly like [return -code return -level $n]"
(in the script domain (not C), for non-negative integers $n, and for [set n+1 [expr {$n+1}]])

If yes, then why two separate codes?
If no, then when use either code?

My use case is a proc that holds common code to return from the calling context (a source'd file).
Regards
Martin

Don Porter

unread,
May 11, 2018, 9:21:29 AM5/11/18
to
On 05/11/2018 08:59 AM, heinrichmartin wrote:
> is the following observation correct?
>
> "[return -code ok -level ${n+1}] behaves exactly like [return -code return -level $n]"
> (in the script domain (not C), for non-negative integers $n, and for [set n+1 [expr {$n+1}]])

Yes.

> If yes, then why two separate codes?

Support for the established syntax of [return] that existed prior to the
introduction of the -level option.

--
| Don Porter Applied and Computational Mathematics Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
0 new messages