daily pastebin goal
71%
SHARE
TWEET

[Perl 6] Slurping parameters.

cwchen Nov 15th, 2017 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sub add(*@args) {
  2.     my $s = 0;
  3.    
  4.     for @args -> $e {
  5.         $s += $e;
  6.     }
  7.    
  8.     $s;
  9. }
  10.  
  11. my $sum = add(1, 2, 3, 4, 5);
  12. $sum == 15 or die "Wrong value";
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