Swift LanguageLoops


Syntax

  • for constant in sequence { statements }
  • for constant in sequence where condition { statements }
  • for var variable in sequence { statements }
  • for _ in sequence { statements }
  • for case let constant in sequence { statements }
  • for case let constant in sequence where condition { statements }
  • for case var variable in sequence { statements }
  • while condition { statements }
  • repeat { statements } while condition
  • sequence.forEach(body: (Element) throws -> Void)