Repeating

Repeating: For Each Thing: `foreach`, Until Something Is True: `while`, `do` and `for`, Stopping Early: `break` and `continue`.

Updated

  1. For Each Thing: `foreach` (Apprentice): The foreach statement runs the steps in its braces once for each item in a list, with a variable you name holding this item, so a script renames 30 files or 200 with one loop and can decide about each one with an if.
  2. Until Something Is True: `while`, `do` and `for` (Apprentice): while repeats steps as long as a condition is true, do runs them at least once and checks at the end, which suits trying again up to three times, and for counts from a start to a finish one step at a time.
  3. Stopping Early: `break` and `continue` (Apprentice): A loop keeps a count or a running total in a variable started before it, continue skips the rest of one pass and goes on with the next item, break leaves the loop at once, and inside ForEach-Object return skips an item instead.