#!/usr/bin/perl6
sub euclidean (Int $a is copy, Int $b is copy) returns Int {
my $c;
while ($b) {
$c = $a % $b;
$a = $b;
$b = $c;
}
return $a;
}
say euclidean(8, 24);
IyEvdXNyL2Jpbi9wZXJsNgpzdWIgZXVjbGlkZWFuIChJbnQgJGEgaXMgY29weSwgSW50ICRiIGlzIGNvcHkpIHJldHVybnMgSW50IHsKCW15ICRjOwoJd2hpbGUgKCRiKSB7CgkJJGMgPSAkYSAlICRiOwoJCSRhID0gJGI7CgkJJGIgPSAkYzsKCX0KCXJldHVybiAkYTsKfQpzYXkgZXVjbGlkZWFuKDgsIDI0KTs=