ForEach constructor

ForEach(
  1. Score score, {
  2. required Widget then(
    1. Score
    ),
  3. int from = 0,
  4. Entity? counter,
  5. int step = 1,
  6. Location? translate,
})

The ForEach Loop repeats a set of commands for each value in a Score. Therefore a file is called recursively and a counter score is increased.

constructor
Score the score to iterate through
then A Function that takes in the count Score
from the initial value for the counter(default = 0)
counter an Entity to hold the count value(default = #objd_foreach)
step how much to increase or decrease the counter each time(default = 1)

Implementation

ForEach(
  this.score, {
  required this.then,
  this.from = 0,
  this.counter,
  this.step = 1,
  this.translate,
}) {
  counter ??= Entity.PlayerName('#objd_foreach');
  _countScore = Score(counter!, 'objd_count');
}