Pascal has three types of loop instruction, one increments a variable, and the other two test a boolean value to see if it is true. One performs the test before executing the loop, the other after executing it.
There are three kinds of loop statements,
repeat always execute the loop at least once, and the
while statement executes it zero or more times.
The For statement sets a control variable to an initial value, then perfoms the loop. at the end of the loop, the control variable is either incremented by 1 or decremented by 1 (depending on whether the loop is increasing or decreasing), and if the value of the control variable is less than the
to value specified (for increasing value loops), or the control variable value is greater than the
to value (for doecreasing value loops), the loop will be executed again.
repeat statement works similarly to the
for statement. The repea5 loop is executed, then a test condition is checked, and if the test result remains true, the loop is executed again.
while statement test a condition, and if true, the loop is executed. At the end of the loop, control retuns back to the start to test if the condition is still true. The Wile loop is the only one where the loop can conceivably be executed zero times.