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.
Dim a As Integer
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 -
Below is each step worked through-
*Note - The above code is in VB.