7.3 The repeat ... while loop
The repeat … while loop replaces the Swift 1.x do .. while loop. It is often helpful to think of the repeat ... while loop as an inverted while loop. The while loop evaluates an expression before executing the code contained in the body of the loop. If the expression evaluates to false on the first check then the code is not executed. The repeat ... while loop, on the other hand, is provided for situations where you know that the code contained in the body of the loop will always need to be executed at least once. For example, you may want to keep stepping through the items in an array until a specific item is found. You know that you have to at least check the first item in the array to have any hope of finding the entry you need. The syntax for the repeat ... while loop is as follows:
repeat {
// Swift statements here
} while conditional expression
In the repeat ... while example below the...