//: Playground - noun: a place where people can play
// loops

import UIKit


// 1 : for-in
var intlist : [Int] = [12, 15, 18, 19, 45, -21]

for index in intlist {
    if(index % 3 == 0) {
        print("\(index) is dividable by 3")
    }
}

// 2 : for  -> C-style for loop removed in swift3
// for(int i = 0 ; i < 22 ; i++){ ... }

for k in 1...10{        // ... : inclusive
    print("k = \(k)")
}

print("----------------------")

for z in 3..<9{
    print("Z : \(z)")
}
print("----------------------")


// step in for loop

for index in stride(from: 2, to: 31, by: 2){ // exclusive  : index < 30
    print("index : \(index)")
}
print("**************************")
// 3 : while

var score : UInt32 = 0
while score < 200 {
    var rand = 5 + arc4random_uniform(6)
    score = score + rand
    print("score : \(score)")
    
}

// 4 : repeat-while : do-while

























