I find myself writing code like this when I want to repeat some execution n times:
for (i <- 1 to n) { doSomething() }
I\'m looking for
It can be as simple as this:
scala> def times(n:Int)( code: => Unit ) { for (i <- 1 to n) code } times: (n: Int)(code: => Unit)Unit scala> times(5) {println("here")} here here here here here