use while loop swift code example
Example 1: swift do while
var x = 0;
while x < 10 {
print "\(x)" //prints x until x < 10 evaluates to false
x = x + 1
}
Example 2: while loop swift
// runs until some boolean expression is false
while booleanExpression {
//block of code to be executed...
}