Skip to content

Instantly share code, notes, and snippets.

@jbilcke
Created July 31, 2013 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbilcke/6126650 to your computer and use it in GitHub Desktop.
Save jbilcke/6126650 to your computer and use it in GitHub Desktop.
wrapper for checking returned values in coffee
result = do (value=some(operation(42))) ->
throw Error "too low" if value < 0.5
value
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