User Tools

Site Tools


simulating_20continue

This is an old revision of the document!


Simulating CONTINUE

by Richard Russell, November 2012

Some dialects of BASIC (e.g. Visual Basic) have a CONTINUE statement, which continues execution at the next iteration of a FOR, REPEAT or WHILE loop. It is equivalent to jumping to the NEXT, UNTIL or ENDWHILE statement (i.e. it skips the remainder of the 'body' of the loop).

The same effect may be achieved in BBC BASIC by using a GOTO, but obviously that isn't very satisfactory. A better way is to use a dummy REPEAT…UNTIL TRUE loop as follows:

        WHILE some_condition
          REPEAT
            REM Do some things
            IF next_iteration THEN EXIT REPEAT : REM CONTINUE
            REM Do some more things
          UNTIL TRUE
        ENDWHILE
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
simulating_20continue.1523990932.txt.gz · Last modified: 2018/04/17 19:48 by tbest3112