Is there a brief syntax for executing a block n times in Scala?
- by Motlin
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 a shorter syntax like this:
n.timesRepeat(doSomething())
Does something like this exist in Scala already?