๋ฐ์ํ
๐ ๋ชฉ์ฐจ
- for in
- for in where
- stride
- forEach
- ์ฐธ๊ณ
๐ for-in
for item in 1...10 {
print(item)
}
๐ for in where
for item in 1...10 where item % 2 == 0 {
print("even: \(item)")
}
๐ stride
for i in stride(from: 10, through: 2, by: -2) {
print(i); // 10 8 6 4 2
}
๐ forEach
var temp = [1, 2, 3]
temp.forEach{ print($0) }
๐ ์ฐธ๊ณ
๋ฐ์ํ
'Swift' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Swift ๊ตฌ์กฐ์ฒด์ ํด๋์ค (0) | 2021.11.21 |
---|---|
Swift ์ต์ ๋ (0) | 2021.11.20 |
Swift ํจ์ (0) | 2021.11.20 |
Swift ์ปฌ๋ ์ ํ์ (0) | 2021.11.20 |
Swift ๋ณ์, ์์ ๊ทธ๋ฆฌ๊ณ ํ์ (0) | 2021.11.19 |