Skip to content

Instantly share code, notes, and snippets.

@enomoto
Last active April 7, 2019 12:35
Show Gist options
  • Save enomoto/fedb348db48548dbbd9fb47dd3bc5e49 to your computer and use it in GitHub Desktop.
Save enomoto/fedb348db48548dbbd9fb47dd3bc5e49 to your computer and use it in GitHub Desktop.
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