daily pastebin goal
71%
SHARE
TWEET

[Perl 6] Creating a subroutine with named parameters.

cwchen Nov 15th, 2017 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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"));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top