nextsame
ErrorsCollection

nextsame

Synthesised documentation from language/functions

From language/functions

See Original text in context

nextsame calls the next matching candidate with the same arguments that were used for the current candidate and never returns.

proto a(|) {*}
 
multi a(Any $x{
    say "Any $x";
    return 5;
}
multi a(Int $x{
    say "Int $x";
    nextsame;
    say "never executed because nextsame doesn't return";
}
 
a 1;        # OUTPUT: «Int 1␤Any 1␤»