sub samewith

Documentation for sub samewith assembled from the following types:

language documentation Functions

From Functions

(Functions) sub samewith

samewith calls current candidate again with arguments provided by users and returns the return value of the new instance of current candidate.

proto a(|) {*}
 
multi a(Int $x{
  return 1 unless $x > 1;
  return $x * samewith($x-1);
}
 
say (a 10); # OUTPUT: «36288000␤»