RosettaCodeData/Task/Greatest-common-divisor/AppleScript/greatest-common-divisor-1.applescript
2023-07-01 13:44:08 -04:00

12 lines
192 B
AppleScript

-- gcd :: Int -> Int -> Int
on gcd(a, b)
if b 0 then
gcd(b, a mod b)
else
if a < 0 then
-a
else
a
end if
end if
end gcd