1. for loop ?
ROB
Why don't you allow us to modify the loop counter in a for loop
like "C" instead of using "BASIC's" step method ?
Add this to the wish list. :)
Bernie
2. Re: for loop ?
Bernie Ryan wrote:
>ROB
> Why don't you allow us to modify the loop counter in a for loop
> like "C" instead of using "BASIC's" step method ?
> Add this to the wish list. :)
>Bernie
Oh boy, here comes the next wave of discussion...
Rod
3. Re: for loop ?
Bernie Ryan wrote:
>ROB
> Why don't you allow us to modify the loop counter in a for loop
> like "C" instead of using "BASIC's" step method ?
Because that kind of thing would cause more problems than it would solve.
When you come across a "for" loop in a Euphoria program, you are absolutely
*guaranteed* that the counter is controlled solely by the "for" loop, and
*cannot* be changed unexpectedly by the programmer. This can help greatly
with debugging, since you *know* the loop counter can't be messed about
with.
If you really *do* need to modify your loop counter for whatever reason,
then instead of this...
for i = 1 to length(s) do
-- whatever
end for
..you can code it like this...
integer i
i = 1
while i <= length(s) do
-- whatever
i += 1
end while
..modifying the loop counter to your heart's content. Not as elegant, I
know, but this way it is obvious that your loop counter is under the
complete control of the programmer. Having these very strong distinctions
between internally-controlled "for" loops and programmer-controlled "while"
loops makes understanding and debugging the code much, much easier.
Be seeing you,
Gabriel Boehme
4. Re: for loop ?
Gabriel you wrote
>>Because that kind of thing would cause more problems than it would solve.
>>When you come across a "for" loop in a Euphoria program, you are
>>absolutely
>>*guaranteed* that the counter is controlled solely by the "for" loop, and
>>*cannot* be changed unexpectedly by the programmer. This can help greatly
>>with debugging, since you *know* the loop counter can't be messed about
>>with.
I have enough concentration and am smart enough to keep track of what is
happening in my for loops. I don't need no guarantees.
Thank you but I didn't need training in how to use a while loop.
Be seeing you,
Bernie
5. Re: for loop ?
Bernie Ryan wrote:
>I have enough concentration and am smart enough to keep track of what is
>happening in my for loops. I don't need no guarantees.
Still, it's nice to have them, all the same.
>Thank you but I didn't need training in how to use a while loop.
Just trying to help, my friend.
Be seeing you, too,
Gabriel Boehme