Advertisement
Guest User

Fruit Flies

a guest
Jun 23rd, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.27 KB | None | 0 0
  1. object Timer {
  2.   def oncePerSecond(callback: () => Unit): Unit = {
  3.     while (true) { callback(); Thread sleep 1000 }
  4.   }
  5.   def timeFlies(): Unit = {
  6.     println("Time Flies like an arrow")
  7.   }
  8.  
  9.   def main(args: Array[String]) {
  10.     oncePerSecond(timeFlies)
  11.   }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement