​Fast is a strong and instinctive development language for macOS, iOS, watchOS and tvOS....

Page 58

Swift

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

46


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.