: Playground-noun:a place where people can play
Import UIKit
/*:
For Loop
* basic usage and OC consistency
* conditional expression must be a value of type bool
* The conditional expression () can be omitted
* in OC if there is only one statement in {} , then {} can be omitted , and Swift cannot
*/
For var i = 0; i < ten; i++
{
Print(i)
}
/*:
Interval
Semi-closed interval : 0..<10 contains head not containing tail
Closed interval : 0...10 contains header containing tail
*/
For i in 0... Ten
{
Print(i)
}
/*:
While Loop
* basic usage and OC consistency
* conditional expression must be a value of type bool
* The conditional expression () can be omitted
* in OC if there is only one statement in {} , then {} can be omitted , and Swift cannot
*/
var num = 0
While num <
{
print(num)
num+ +
}
/*:
Repeat while Loop
* basic usage and OC consistency
* conditional expression must be a value of type bool
* The conditional expression () can be omitted
* in OC if there is only one statement in {} , then {} can be omitted , and Swift cannot
*/
var value = 0
repeat{
Print (value)
value++
}while value <
Swift 2.0 Syntax Loop