Advertisement
cwchen

[Perl 6] Returning multiple values.

Nov 15th, 2017
1,171
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sub divmod(Int $a, Int $b) {
  2.     $a div $b, $a mod $b;
  3. }
  4.  
  5. my ($a, $b) = divmod(5, 3);
  6. $a == 1 or die "Wrong value";
  7. $b == 2 or die "Wrong value";
Advertisement
RAW Paste Data Copied
Advertisement