Dart Loops : For Each in Loop

Dart Loops : For Each in Loop

ยท

1 min read

In dart there are total 5 types of Loops.

  1. For Loop

  2. For....in Loop

  3. For Each Loop

  4. While Loop

  5. Do.....While Loop

In this section we will see about Dart " For each Loop " .

  • The for-each loop iterates over all elements in some container/collectible and passes the elements to some specific function.
void main() {
  var list = [2, 4, 8, 16, 32];
  list.forEach((n) => print('$n'));
}

ย