O'Reilly logo

DarkBASIC Pro Game Programming, Second Edition by Joshua R. Smith, Jonathan S. Harbour

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding Looping Statements

There are four looping statements available in DarkBASIC, and it’s important to understand the strengths and weaknesses of each, how they compare with each other, and when each type of loop is preferable. The four looping statements are

  • FOR . . . NEXT. This loop iterates a specific number of times.

  • DO . . . LOOP. This loop is endless.

  • REPEAT . . . UNTIL. This loop repeats until a condition is met.

  • WHILE . . . ENDWHILE. This loop repeats while a condition remains true.

I’ll explain each of these statements in detail shortly. In the meantime, I’d like to provide you with a little background information.

What Is a Loop?

A loop can be defined as anything that repeats something over and over. It has a starting point ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required