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

当调用 next 时触发的 控制异常

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

这将打印

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

方法§

方法 message§

method message()

返回 '<next control exception>'