Skip to content

Instantly share code, notes, and snippets.

@rcoh
Last active August 29, 2015 14:00
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 rcoh/11387293 to your computer and use it in GitHub Desktop.
Save rcoh/11387293 to your computer and use it in GitHub Desktop.
Scala Nested Closures
def inlineMeAgain[T](f: => T): T = {
f
}
def inlineme(f: => Int): Int = {
try {
inlineMeAgain {
return f
}
} catch {
case ex: Throwable => 5
}
}
def doStuff {
val res = inlineme {
10
}
println("we got: " + res + ". should be 10")
}
doStuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment