1.
for (index, m) in moves.enumerated() {
for i in 0...m {
}
}
다양한 for 문 예제
let contacts = ["adam" : 1234, "james" : 1235, "amy" : 09123]
let word = "supercalifragile"
let halfOpenRange = 1..<5 // 1,2,3,4
let closedRange = 1..5 // 1,2,3,4,5
for letter in word {
print(letter)
}
for person in contacts {
print(person.key)
print(person.value)
}
for _ in halfOpenRange {
print(number)
}
'Swift' 카테고리의 다른 글
swift - map / with index (0) | 2021.11.20 |
---|---|
Swift- Extension (String) (0) | 2021.11.16 |
Swift, trial, Array method, joined (0) | 2021.11.16 |
Swift, trial, String : 자르기/replacingOccureences/using startIndex / Index / Substring (0) | 2021.11.14 |
Xcode - Swift - github repository push 방법 (0) | 2021.11.13 |