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!
SPONSORED Join a FREE crash course for iOS devs who want to become complete senior developers — from October 18th to 24th. Learn how to apply iOS app architecture patterns through a series of lectures and practical coding sessions.
Link copied to your pasteboard.