Looking for swift Answers? Try Ask4KnowledgeBase
Looking for swift Keywords? Try Ask4Keywords

Swift Language Repeat-while loop


Example

Similar to the while loop, only the control statement is evaluated after the loop. Therefore, the loop will always execute at least once.

var i: Int = 0

repeat {
   print(i)
   i += 1
} while i < 3

// 0
// 1
// 2