## `next` -- skip a step in a loop

#### Introduction

`next` interrupts the current step in `for`, `repeat`, and `while` loops. Execution proceeds with the next step of the loop.

#### Call(s)

next `_next()`

#### Related Functions

`break`, `case`, `for`, `quit`, `repeat`, `return`, `while`

#### Details

- The `next` statement is equivalent to the function call `_next()`. The return value is the void object of type `DOM_NULL`.
- Inside `for`, `repeat`, and `while` loops, the `next` statement interrupts the current step of the loop. In `for` statements, the loop variable is incremented and execution continues at the beginning of the loop. Similarly, the control conditions at the beginning of a `while` loop and in the `until` clause of a `repeat` loop are verified, before execution continues at the beginning of the loop.
- Outside `for`, `repeat`, and `while` loops, the `next` statement has no effect.
- `_next` is a function of the system kernel.

#### Example 1

In the following `for` loop, any step with even `i` is skipped:

    >> for i from 1 to 5 do
         if testtype(i, Type::Even) then next end_if;
         print(i)
       end_for:

                                         1

                                         3

                                         5

In the following `repeat` loop, all steps with odd `i` are skipped:

    >> i := 0:
       repeat
         i := i + 1;
         if testtype(i, Type::Odd) then next end_if;
         print(i)
       until i >= 5 end_repeat:

                                         2

                                         4

    >> delete i:

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000