|
Scala example source code file (retclosure.scala)
The Scala retclosure.scala source code
/* Test return expressions inside closures.
*
* See bug#834 */
object Test {
def response: String = {
def check: Option[String] = {
val closure: String=>Nothing =
p => return Some("some problem") // should return from check
closure("whatever")
}
check match {
case Some(problem) => "check failed: " + problem
case None => "ok"
}
}
def main(args: Array[String]) {
Console.println(response)
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala retclosure.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.