Keyword

# Continue

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to to <span class="title-ref">Continue</span> execution with the next iteration of a loop, skipping any other code.

## Usage

``` xojo
Continue
```

or

``` xojo
Continue [ For | While | Do ]
```

or

``` xojo
Continue For LoopVariable
```

| Part         | Type                                                                                                                                   | Description                                                                                                     |
|--------------|----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
| LoopVariable | Datatype of a loop variable: `Integer</api/data_types/integer>`, `Single</api/data_types/single>`, or `Double</api/data_types/double>` | The loop variable that controls iteration of the loop that you want to <span class="title-ref">continue</span>. |

## Notes

The <span class="title-ref">Continue</span> statement enables you to jump to the end of a loop and <span class="title-ref">Continue</span> execution without executing the lines of code between the <span class="title-ref">Continue</span> statement and the end of the loop. If there is ambiguity concerning which loop you mean, you can use the second or third syntaxes to clarify the situation. For example, if you have nested `For...Next</api/language/loops/for...next>` loops and want to jump from a line in the innermost loop to the outermost loop, you can use the last syntax to identify the loop variable that controls the outermost loop.

## Sample code

Count the sum from 1 to 100, skipping the number 2 and 31:

``` xojo
Var sum As Integer

For i As Integer = 1 To 100
  If i = 2 Or i = 31 Then Continue

  sum  = sum + i
Next
```

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

If you have nested For loops and want to jump from a line in the innermost loop to the outermost loop, you can use the last syntax to identify the loop variable that controls the outermost loop.

``` xojo
For i As Integer = 1 To 100
  For j As Integer = 1 To 200
    If j = 50 Then
      Continue For i ' Exits For j and resumes For i
    End If
  Next j
Next i
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Do...Loop</api/language/loops/do...loop>`, `Exit</api/language/loops/exit>`, `For</api/language/loops/for...next>`, `While...Wend</api/language/loops/while...wend>` statements.

</div>
