The "Continue" Statement

This section covers the "continue" statement.

The continue statement has the form:

GML Code Example


If used inside of a statement that forms a loop (repeat, while, do... until or for), it will immediately jump back to the beginning of the loop as if the loop had run through and looped back (if used outside of a loop it acts as an exit statement, exiting the event). It will also do the same when using the with function, where it will cause the code to skip to the next instance and run again.

Below is an example of its use in a "for" loop:

GML Code Example

 var i;
 for (i = 0; i < 10; i += 1)
    if array[i] = "" continue;
    array[i] = "";

The above code will skip back to the beginning of the loop if the array[i] value is already an empty string.

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here