Skip to content

Instantly share code, notes, and snippets.

@ebongzzang
Created July 4, 2018 06:32
Show Gist options
  • Save ebongzzang/7bdc696fed4dde3c217d33403d9f1557 to your computer and use it in GitHub Desktop.
Save ebongzzang/7bdc696fed4dde3c217d33403d9f1557 to your computer and use it in GitHub Desktop.
groovy recursive closure
def main() {
def input = 192
def gcd
gcd = { int val, int remainder ->
if(remainder ==0){
return val
}
return gcd(remainder, val % remainder)
}
print(gcd(1440, 408))
}
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment