While
While loops repeatedly check a condition and run a block of code until the condition is false.
main.w
let var i = 0;
while i < 100 {
  i = i + 1;
  if i == 20 {
    // although the while loop goes to 100, we break it at 20
    break;
  }
  if i % 2 == 0 {
    // continue for even numbers
    continue;
  }
  log("{i}");
}
Wing console output
# Run locally with wing console
wing it
1
3
5
7
9
11
13
15
17
19