STRIDE

· iOS/Swift
stride는 시작값(from)에서부터 끝값을 포함(through)하거나, 미포함(to)할 때까지 지정한 양(by)만큼 늘어나는 시퀸스를 반환하는 제네릭 함수입니다. // stride(from:to:by)는 to를 포함하지 않음 for i in stride(from: 0, to: 5, by: 1) { print(i) // 0, 1, 2, 3, 4 } // stride(from:through:by)는 through를 포함 for i in stride(from: 0, through: 5, by: 1) { print(i) // 0, 1, 2, 3, 4, 5 }
SwiftyCody
'STRIDE' 태그의 글 목록