Nope. Pascal and especially Modula-2, mothers of high-level languages, did calculate the bounds only once. Most others that do it the other way are probably just following the bad example of C
Indeed! I didnât know this fact, either. But then, I never handled VB. Iâm surprised that the RB docs do not point this out more clearly.
I have write access to the LR, so Iâll update the doc on forâŠnext right now.
Jeez! That ForâŠNext page was full of mistakes and bad examples. I have taken a full hour to work it over . Please take a look and let me know if you find any errors, unclarities or bad wording in it so that I can fix it right away:
Well I used to have edit access, but I guess I donât any more (I can log in, but not edit). Anyway, I donât have anything major but some minor things that I see are:
- âEndâ is capitalized in the for statement, but is lowercase in the table with Part and Description.
- âStatementsâ should be capitalized in the part/description table as well.
- You might want to add an example using a step value of -1 that is the same as the DownTo example shown at the very end, just to show that theyâre the same.
Thanks for editing it!
The only other thing that I can see is that the [Exit] parameter should be [Exit [For]], as it seems as if both syntaxes will work. âExit Forâ is the VB standard.
I like the revisions. One more important thing to add:
When multiple threads are running, be aware that threads may yield at every loop iteration. This can also be expensive, and if undesired, one can use #pragma BackgroundThreads to control the yielding behavior.