Swift: While statement

This entry is part 4 of 41 in the series Swift

If you are new to Apple’s swift like me, you might not know how to turn on the console to view the output. ¬†For XCode, you can go to View -> Debug Area -> Activate Area.

Here we show how to use the while statement.

import UIKit

var number = 2

while (number <= 10)
    number = number + 1


Series Navigation<< Swift: If else statement
Swift: Escaping a variable >>