Saying goodbye to i++

So, how do we execute loops in an expressive and concise way without our trusted old i++ syntax? Well, Swift has a few options here, depending on exactly what you want to accomplish:

  • for loops iterate over ranges and collections
  • while loops run until a condition is no longer met