April 2017
Intermediate to advanced
316 pages
9h 33m
English
Swift provides while and repeat-while loops. A while or repeat-while loop performs a set of expressions until a condition becomes false. Consider the following example:
var n = 2 while n < 100 { n = n * 2 } var m = 2 repeat { m = m * 2 } while m < 100
The while loop evaluates its condition at the beginning of each iteration. The repeat-while loop evaluates its condition at the end of each iteration.
Read now
Unlock full access