repeat function

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

Executes the given function action specified number of times.

Implementation

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