fork(1) download
  1. #!/usr/bin/perl6
  2. sub euclidean (Int $a is copy, Int $b is copy) returns Int {
  3. my $c;
  4. while ($b) {
  5. $c = $a % $b;
  6. $a = $b;
  7. $b = $c;
  8. }
  9. return $a;
  10. }
  11. say euclidean(8, 24);
Success #stdin #stdout 0.12s 99904KB
stdin
Standard input is empty
stdout
8