// See http://www.ibm.com/developerworks/jp/java/library/j-scala01228.html

package scalaapplication

object Timer {
    def oncePerSecond(seconds: Int, callback: () => Unit): Unit = {
        while (true) {
            callback()
            Thread.sleep(seconds)
        }
    }

    def main(args: Array[String]): Unit = {
        oncePerSecond(1000,
                      () => Console.println("Time flies when you're having fun(ctionally)...") )
    }
}
