Swift 3 if for logic

Swift 3

From swift 3, legacy way to write for loop is prohibited(Compile Error)

For

Use range

for index in 1...5 {
    print("\(index) times.")
}

Use range but no need to use var

for _ in 1...5 {
    
}

We cannot use following way(Error)

for var index=1; index < 4; index++ {
    print("\(index)")
}

Use count for Array

let names = ["Chika", "You", "Riko"]
print(names.count)
for i in 0..< names.count {
    print("\(i+1) : \(names[i])")
}

Get data but you don't use

let names = ["Chika", "You", "Riko"]

for _ in names {
    print("test")
}

Use data

let names = ["Chika", "You", "Riko"]
for var name in names {
    print(name)
}

if

let i = 3
if i < 3 {
    print("less")
}

if i <= 3 {
    
}
else if (i == 5) {
    
}
else {
    
}

repeat-while

While

var index2 = 0
while index2 < 5 {
    index2 += 1
    print(index2)
}

Repeat while

var rep = 0
repeat {
    rep+=1
} while rep < 1

swift

let numbers = 3
switch numbers {
case 1, 2:
    print("1, 2")
case 3,4,5:
    print("3,4,5")
default:
    print("")
}