A counting loop in Pseudocode is similar to a conditional loop, or how you would define a counting loop in a flowchart. In fact, you can write a conditional loop to solve a counting loop in pseudocode.
While a conditional loop is designed to do something while a condition is met, a counting loop is designed to do something a set number of times. The number of times can be hard coded, or use a variable to define the beginning and/or ending values.
We will need to use a variable to track the number of times we perform a loop such like you see below:
for i = 1 to 10
Here we specify a variable i, and it is to count from 1 to 10.
If we wanted to use a variable for the beginning and ending values, we can do something like:
start = 10
stop = 100
for i = start to stop
Additionally, while we normally count by ones, we don’t have to. We can count by any number we want.
for i = 1 to 101 increment by 10
Of course, we don’t have to say increment by, we might just say by, or some other phrase which will be obvious to the people using the pseudocode.
Loop Body
The body, just like with the condition loop, will be indented, to show what goes with what.
You do not need to update the counter variable, often the letter i. This is considered done for you automatically as part of a counting loop.
for i = 1 to 10
print i
Counting Loops in Pseudocode was originally found on Access 2 Learn