role CX::Next does X::Control { }

A control exception that is triggered when next is called.

for ^10 {
    CONTROL {
      when CX::Next { say "We're next" };
    }
    next if $_ %% 2;
    say "We're in $_";
}

This will print:

We're next
We're in 1
We're next
We're in 3
We're next
We're in 5
We're next
We're in 7
We're next
We're in 9

Methods§

method message§

method message()

Returns '<next control exception>'.

Typegraph§

Type relations for CX::Next
raku-type-graph CX::Next CX::Next Exception Exception CX::Next->Exception X::Control X::Control CX::Next->X::Control Mu Mu Any Any Any->Mu Exception->Any X::Control->Exception

Expand chart above