repeat function

Unit repeat(
  1. Int times,
  2. Unit action(
    1. Int
    )
)

Executes the given function action specified number of times.

Implementation

Unit repeat(Int times, Unit Function(Int) action) {
  for (var i = 0; i < times; i++) {
    action(i);
  }
}