I have a case where I want to call a method n times, where n is an Int. Is there a good way to do this in a \"functional\" way in Scala?
case class Event(name: S
With recursion:
def repeat(n: Int)(f: => Unit) { if (n > 0) { f repeat(n-1)(f) } } repeat(event.quantity) { queue.enqueue(event.value) }