Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object Timer {
- def oncePerSecond(callback: () => Unit): Unit = {
- while (true) { callback(); Thread sleep 1000 }
- }
- def timeFlies(): Unit = {
- println("Time Flies like an arrow")
- }
- def main(args: Array[String]) {
- oncePerSecond(timeFlies)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement