Skip to content

Instantly share code, notes, and snippets.

@ezura
Created March 31, 2016 10:52
Show Gist options
  • Save ezura/f443a90ae61cd697f7f9b76be96a1079 to your computer and use it in GitHub Desktop.
Save ezura/f443a90ae61cd697f7f9b76be96a1079 to your computer and use it in GitHub Desktop.
あらら、変な guard の使い方してた(´・ω・`) #CodePiece
AnyGenerator {
defer {
iteration += 1
}
// こっちはダメ
guard iteration > 3 else {
return iteration
}
return nil
}
AnyGenerator {
defer {
iteration += 1
}
// こっちが良い
guard iteration < 3 else {
return nil
}
return iteration
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment