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.
forloops give you, use an underscore instead so Swift can skip that work.
whileloops, which you provide with an explicit condition to check.
repeatloops always run the body of their loop at least once.
break, but if you have nested loops you need to use
breakfollowed by whatever label you placed before your outer loop.
while true. Make sure you have a condition somewhere to end your infinite loops!
HACKING WITH SWIFT LIVE This July is a new two-day event where you'll be inspired by great speakers on day one then learn all the amazing new features from WWDC on day two – click here for more information and tickets.