Re: Why doesn't foreach return a value
- From: Darren New <dnew@xxxxxxxxxx>
- Date: Wed, 30 Jan 2008 08:47:26 -0800
tom.rmadilo wrote:
Foreach actually never 'goes away', so how could it return?
Of course it returns, like every other command does. (Well, except infinite loops.) What do you mean "goes away"?
Is it called as a function, or is is simply used in the current flow of code?
It's called as a function, as is every other command in Tcl, including proc, while, if, and so on.
I doubt you will find any logical support for anything in particular.
Returning either the second argument or the final value of the first argument or the length of the second argument might all be useful. But these are all things that are trivial to get in other ways.
If "break" was changed to take an argument, returning the value passed to break might be interesting. But again, I expect this can already be done with clever use of [return].
The most obviously useful information would be some kind of metadata
which documents what happened, mostly for the case of continuing,
Continuing what? The loop runs until it exits, at which point you don't continue it.
maybe what state the loop was in upon exit.
What do you mean? What state do you not get when you exit?
--
Darren New / San Diego, CA, USA (PST)
On what day did God create the body thetans?
.
- Follow-Ups:
- Re: Why doesn't foreach return a value
- From: tom.rmadilo
- Re: Why doesn't foreach return a value
- References:
- Re: Why doesn't foreach return a value
- From: Rufus V. Smith
- Re: Why doesn't foreach return a value
- From: Mark Janssen
- Re: Why doesn't foreach return a value
- From: tom.rmadilo
- Re: Why doesn't foreach return a value
- Prev by Date: Re: Package unloading
- Next by Date: clock scan
- Previous by thread: Re: Why doesn't foreach return a value
- Next by thread: Re: Why doesn't foreach return a value
- Index(es):
Relevant Pages
|