The instructions here are for VB but the process is the same for all languages.

There are very specific differences between the three types of iteration (or repetition) which are important to understand when selecting which one to use. The table below outlines these differences.

Repetition Type

Counter increment


Condition to loop




Continues until the counter reaches the value specified in the TO clause

Repeat- Until



Will only loop if the condition is false




Will only loop if the condition is true

Dim a As Integer
For a=5 to 10
    PRINT a * 2

The for loop above is very simple and allows us to pick up the three main parts of repetition. These are highlighted below.

The counter, a , is set initially to the value 5. The keyword next means that when the code gets here it is to step to the next iteration (or loop) and also increment the counter, a , by 1. Finally we keep going until the counter reaches 10. Understanding these three ideas are all you need to know in order to convert a loop. Below is the steps you must follow to perform the conversion -

  1. Swap the start and end of the loop for the new keywords
  2. Change the initialization
  3. Add/remove increment code
  4. Alter the condition

Below is each step worked through-

*Note - The above code is in VB.