The WHILE-DO Loop Page

The purpose of this program fragment is to show how a loop-control variable can be used to generate non-sequential values using the WHILE-DO loop. This fragment prints the first three even Natural numbers.

The Source

The Variables

1   2   3   4   5   6   7   8   9   10   11   12   13   14   15   NEXT  

The Output

The Source

This statement will initialize the loop-control variable, providing the first value of the desired sequence.


The Variables

Currently, num contains the default value of 0.



Back to Main Page
© 2001 DFStermole
Last Modified 31 Oct 2001