repeat function

dynamic repeat(
  1. int times,
  2. void action(
    1. dynamic int
    )
)

Executes the given function action specified number of times.

Implementation

repeat(int times, void action(int)) {
  for (int i = 0; i < times; i++) {
    action(i);
  }
}