June 25, 2024, 06:22:23 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


The FOR loop

Started by Parker, January 08, 2006, 04:48:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Parker

While converting some code, I'm wondering how exactly the FOR loop in Aurora compares to a BASIC-style one. We have the syntax for(assignment; comparison; assignment) which makes a lot more sense to me how it actually works, since you can make i < 20, <=, or whatever you want. But I'm just wondering, how exactly is this translated:
FOR i = 0 TO 20
Does that mean that i goes up through 20, or that it stops right before 20, in which case I would write
for (i = 0; i < 20; i++) {

Ionic Wind Support Team

In BASIC it includes the last number in the loop so FOR x=0 to 20 will do 21 iterations.
Ionic Wind Support Team

Parker

Thanks, I've always wondered about that, now I'm sure.