> Another liberal (bad!) interpretation of the docs
> 
> continue
> If you are within any kind of loop (For, for each, While, Repeat), the 
> continue keyword (used on a line by itself ) will transfer execution directly 
> to the top of the loop. The loop variable in a For loop will be incremented 
> according to the For clause. If you use continue outside of a loop it will 
> generate an error.
> 
> It does not say it will do a "next recored([table])" in a "while (not(end 
> selection([table])))" loop, just a for loop


I may *seem* to work magic at times, but you will have to forgive me for not 
being able to magically determine your intention to do a next record() in this 
case. My psychic powers must have been below par when I wrote the continue 
command.  ;)

I really killed myself to be as precise as possible in the documentation. If I 
specifically mention certain behaviors, those are the *only* behaviors you can 
expect. The fact that I do *not* explicitly mention other behaviors explicitly 
means that you cannot expect other behaviors.

Some people have criticized me for this, but if you think about it that is the 
only thing that makes sense. Otherwise the documentation would have to be 
something like this:

continue
If you are within any kind of loop (For, for each, While, Repeat), the continue 
keyword (used on a line by itself ) will transfer execution directly to the top 
of the loop. The loop variable in a For loop will be incremented according to 
the For clause.

continue will NOT do the following:

- Erase your data file.
- Make coffee for you.
- Initialize all variables in the application to zero.
- Anything else you can imagine.

Having said that, there is one behavior of the continue command which I forgot 
to explicitly document (which I am now fixing). In addition to incrementing a 
for loop, continue will also increment a for each loop. In general, if you want 
to loop through a selection, instead of using the standard while (not(end 
selection([table]))) mantra, you can just do this:

for each ([table])
   // whatever
end for each

The next record() is done for you. And if you use continue within that loop, 
when it jumps to the top of the loop the next record is fetched.

Kind regards,

   Aparajita
   www.aparajitaworld.com

   "If you dare to fail, you are bound to succeed."
   - Sri Chinmoy   |   www.srichinmoy.org

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to