For Loop


for z in 0..<10
{
  print(z)
}

Going through an integer array:

var num: [Int] = [3, 4, 5, 6]
for n in num
{
  print(n)
}

Notes:
From 0 to 9
This will not work: for var z = 0; z < 10; z++
If you were to type:
for var z in 0..<10, you will get an error


Comments

Popular posts from this blog

Setting up a playground

Go to another page