CONTINUE: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
m (Removed protection from "CONTINUE")
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:_CONTINUE}}
{{DISPLAYTITLE:_CONTINUE}}


The [[_CONTINUE]] statement is used in a [[DO...LOOP]], [[WHILE...WEND]] or [[FOR...NEXT]] block to skip the remaining lines of code in a block (without exiting it) and start the next iteration. It works as a shortcut to a [[GOTO]], but without the need for a [[line numbers|line label]].  
The [[_CONTINUE]] statement is used in a [[DO...LOOP]], [[WHILE...WEND]] or [[FOR...NEXT]] block to skip the remaining lines of code in a block (without exiting it) and start the next iteration. It works as a shortcut to a [[GOTO]], but without the need for a [[line numbers|line label]].




Line 9: Line 9:


{{PageAvailability}}
{{PageAvailability}}
* '''QB64 1.2 and up''' (QB64 Team)
* '''QB64 v1.2 and up'''
* '''QBPE 0.5 and up''' (QB64 Phoenix Edition)
* '''QB64-PE all versions'''




Line 16: Line 16:
''Example:''
''Example:''
{{CodeStart}}
{{CodeStart}}
{{Cl|FOR}} i = 1 {{Cl|TO}} 10
{{Cl|FOR}} i = {{Text|1|#F580B1}} {{Cl|TO}} {{Text|10|#F580B1}}
     {{Cl|IF}} i = 5 {{Cl|THEN}} {{Cl|_CONTINUE}}
     {{Cl|IF}} i = {{Text|5|#F580B1}} {{Cl|THEN}} {{Cl|_CONTINUE}}
     {{Cl|PRINT}} i;
     {{Cl|PRINT}} i;
{{Cl|NEXT}}
{{Cl|NEXT}}
Line 31: Line 31:
* [[FOR...NEXT]]
* [[FOR...NEXT]]
* [[GOTO]]
* [[GOTO]]


{{PageNavigation}}
{{PageNavigation}}

Latest revision as of 17:01, 21 March 2023


The _CONTINUE statement is used in a DO...LOOP, WHILE...WEND or FOR...NEXT block to skip the remaining lines of code in a block (without exiting it) and start the next iteration. It works as a shortcut to a GOTO, but without the need for a line label.


Syntax

_CONTINUE


Availability

  • QB64 v1.2 and up
  • QB64-PE all versions


Examples

Example:

FOR i = 1 TO 10
    IF i = 5 THEN _CONTINUE
    PRINT i;
NEXT
 1  2  3  4  6  7  8  9  10


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link