sub nextwith

Documentation for sub nextwith assembled from the following types:

language documentation Functions

From Functions

(Functions) sub nextwith

nextwith calls the next matching candidate with arguments provided by users and never returns.

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