Page 58


Swift – while Loop A while loop statement in Swift programming language repeatedly executes a target statement as long as a given condition is true.

Syntax The syntax of a while loop in Swift programming language is: while condition { statement(s) } Here statement(s) may be a single statement or a block of statements. The condition may be any expression. The loop iterates while the condition is true. When the condition becomes false, the program control passes to the line immediately following the loop. The number 0, the strings '0' and "", the empty list(), and undef are all false in a Boolean context and all other values are true. Negation of a true value by ! or not returns a special false value.

Flow Diagram


​Quick is just a powerful and spontaneous programming language for macOS, iOS, watchOS and tvO...