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.times(doSomething())
Does something like this exist in Scala already?
EDIT
I thought about using Range's foreach() method, but then the block needs to take a parameter which it never uses.
(1 to n).foreach(ignored => doSomething())