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!
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 trial
David Walker318 Points
coding a for in loop
For this challenge, we're going to use a for in loop to compute the multiplication table for 6 and append the results to an array.
To start off, I've created an empty array of type Int and assigned it to a variable named results. Note that we have to explicitly declare the type here so that the compiler knows this array will hold Int values.
Your task for this step is to create a for in loop that iterates over a range. Multiplication tables typically range from 1 to 10 (with 10 included) so the range you are iterating over should go from 1 to 10.
For in loops also define a constant that temporarily stores the value in the iteration process. For the loop you're writing, name this constant multiplier.
I have watched the videos 3 times and I am still clueless at how to do this
Jennifer NordellTreehouse Teacher
I posted a solution and fairly detailed explanation of this challenge not too long ago. Take a look here:
Hope this helps!
Saeid Pourezzat465 Points
The same problem for me! thx to Jennifer! But i am still a lit confused about loops!