Skip to content

Instantly share code, notes, and snippets.

@mike-neck
Created July 5, 2011 08:36
Show Gist options
  • Save mike-neck/1064489 to your computer and use it in GitHub Desktop.
Save mike-neck/1064489 to your computer and use it in GitHub Desktop.
get minimum value and maximum value
def max = {num1, num2 ->
(num1 - num2 > 0) ? num1 : num2
}
def min = {num1, num2 ->
(num1 - num2 > 0) ? num2 : num1
}
assert max(1,2) == 2
assert min(2,1) == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment