Created
July 31, 2013 22:10
-
-
Save jbilcke/6126650 to your computer and use it in GitHub Desktop.
wrapper for checking returned values in coffee
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
result = do (value=some(operation(42))) -> | |
throw Error "too low" if value < 0.5 | |
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
val result = some(operation(42)) match { | |
case value => { | |
if (value < 0.5) { | |
throw new RuntimeException("too low") | |
} else { | |
value | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment