Last active
August 4, 2016 17:47
-
-
Save davidChu201/93a65d149034896f608c91d454e9b04a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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")) | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This example is from scala vs java