Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPeter Bozic
453 Pointshow to stop infinite loop
when going through this lesson I got in an infinite loop, I can't even get back into xcode now. need help please.
1 Answer
Margeaux Spring
34,865 Pointsyou have to add
index++
to your loop to increment your index or it can crash xcode. I would just make a new playground WITH that line in it and delete the old one.
var todo : [String] = [ "Return calls",
"Write post",
"Cook dinner",
"Pickup Laundry",
"Buy hyacinth bulbs" ]
var index = 0
while index < todo.count {
print(todo[index])
index++
}
Sidney Eubanks
3,864 PointsSidney Eubanks
3,864 PointsI think command z can get out out of it.