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 trialswiftdev
3,655 PointsConfused
I don't understand the challenge at all.
1 Answer
Jayden Spring
8,625 PointsA for in loop is a simple enumeration, if you have worked in Javascript or PHP before you would know this as a foreach loop quite simply it will loop through a collection from the first index until the last.
Therefore if you have your array with 10 values it would read something like this
var results : [Int] = [1,2,3,4,5,6,7,8,9,10];
for index in results
{
print("The value is: \(index)");
}
I suggest having a read through here; https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/ControlFlow.html
As this is really a fundamental aspect of collection's. Hope this helps.
swiftdev
3,655 PointsThe only other thing I've used is Python but I still don't really get for in loops.
Amanda Baldwin
2,983 PointsAmanda Baldwin
2,983 PointsWhat challange is it?