You’ve made it to the end of the fourth part of this series, so let’s summarize:
for
, which assigns each item inside the loop to a temporary constant.for
loops give you, use an underscore instead so Swift can skip that work.while
loops, which you provide with an explicit condition to check.while
loops, repeat
loops always run the body of their loop at least once.break
, but if you have nested loops you need to use break
followed by whatever label you placed before your outer loop.continue
.while true
. Make sure you have a condition somewhere to end your infinite loops!SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!
Sponsor Hacking with Swift and reach the world's largest Swift community!
Link copied to your pasteboard.