Advertisement
cwchen

[Perl 6] Subroutine overloading

Nov 15th, 2017
1,266
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. multi congratulate($name) {
  2.     "Happy birthday, $name".say;
  3. }
  4. multi congratulate($name, $age) {
  5.     "Happy {$age}th birthday, $name".say;
  6. }
  7.  
  8. congratulate('Larry');
  9. congratulate('Bob', 45);
Advertisement
RAW Paste Data Copied
Advertisement