sub nextsame

Documentation for sub nextsame assembled from the following types:

language documentation Functions

From Functions

(Functions) sub nextsame

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␤»