Changes

Jump to: navigation, search

Swift Flow Control

31 bytes added, 15:47, 23 December 2015
The do ... while loop
<google>BUY_IOS8</google>
== The do ... while loop ==
<google>ADSDAQBOX_FLOW</google>
It is often helpful to think of the do ... 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 do ... 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 do ... while loop is as follows:

Navigation menu