Skip to content

Instantly share code, notes, and snippets.

@davidChu201
Last active August 4, 2016 17:47
Show Gist options
  • Select an option

  • Save davidChu201/93a65d149034896f608c91d454e9b04a to your computer and use it in GitHub Desktop.

Select an option

Save davidChu201/93a65d149034896f608c91d454e9b04a to your computer and use it in GitHub Desktop.
Use Scala function as the returned value from another function:
class Test3 {
def saySth(prefix: String) = (s: String) => {
prefix + " " + s
}
}
object Main {
def main(args: Array[String]) {
val sayHello = new Test3().saySth("Hello")
println(sayHello(" Learn4master"))
}
}
@davidChu201
Copy link
Author

This example is from scala vs java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment