Skip to content

Instantly share code, notes, and snippets.

@peysal
Created November 17, 2012 05:59
Show Gist options
  • Save peysal/4093681 to your computer and use it in GitHub Desktop.
Save peysal/4093681 to your computer and use it in GitHub Desktop.
Basic scala
//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