Created
November 17, 2012 05:59
-
-
Save peysal/4093681 to your computer and use it in GitHub Desktop.
Basic scala
This file contains 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
//val cannot be change | |
val two = 1 + 1 | |
//functions are object | |
object Timer { | |
def oncePerSecond(callback: () => Unit) { | |
while (true) { callback(); Thread sleep 1000 } | |
} | |
def timeFlies() { | |
println("time flies like an arrow...") | |
} | |
def main(args: Array[String]) { | |
oncePerSecond(timeFlies) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment