box-o-sand/oldstuff/scala/official-tutorial/Timer.scala
2015-06-22 13:15:42 -05:00

16 lines
303 B
Scala

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)
}
}
// vim: set ts=4 sw=4 et: