Sazzad Hissain Khan Sazzad Hissain Khan - 1 year ago 115
Swift Question

do while loop in Swift

I know that while and for loop is useful in most of the cases. But still is some situation do-while loop is more useful. My question is what is the equivalent syntax for do while in Swift?

Answer Source

Here’s the general form of a repeat-while loop for Swift

repeat {
} while condition

For example,

repeat {
    //take input from io standard into n
} while n <= 10

This loop will run until you provide n > 10

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download