Skip to content

Instantly share code, notes, and snippets.

@k-enomoto k-enomoto/stride.swift
Last active Apr 7, 2019

Embed
What would you like to do?
replacement of C style for loop in Swift 5(Xcode 10.2)
// for var i = 0; i < 5; i += 1
for i in stride(from: 0, to: 5, by: 1) {
print(i) // 0, 1, 2, 3, 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.