WHILE-WEND Loops.

        WHILE WEND loops are similar to pre-test type of DO-LOOPs in the sense that they perform a block of code while a condition is true. However I'm not going to stress the use of these because the DO-LOOPS offer a much nicer and more flexable way of performing a loop. Here is an example of a WHILE-WEND loop:

        X% = 0
        WHILE X% < 5
          X% = X% + 1
          PRINT X%
        WEND

Output:
        1
        2
        3
        4
        5

        Some things that you may want to note about this loop are: Like DO-LOOPs if the condition is not or cannot the loop will continue to cycle. If you jump into the middle of a WHILE-WEND loop with a GOTO you may get an error, like: WEND without WHILE. Also This loop must contain a condition to be a valid statement.

    Back         Tutorial Part 1         Next