Advertisement
cwchen

[Perl 6] Creating a subroutine with named parameters.

Nov 15th, 2017
1,139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 6 0.17 KB | None | 0 0
  1. sub greet(:msg($g) = "Hello", :name($n) = "World") {
  2.     "$g $n".say;
  3. }
  4.  
  5. greet();
  6. greet(:msg("Goodbye"));
  7. greet(:name("Michael"));
  8. greet(:name("Jenny"), :msg("Hi"));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement