Created
July 5, 2011 08:36
-
-
Save mike-neck/1064489 to your computer and use it in GitHub Desktop.
get minimum value and maximum value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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