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 trialBryce Patrick
10,099 PointsI cannot get past this question. My range is set to 1...10 which should be retrieving the first 10 multiples of 6.
What do i need to fix in my code to get to the next step? Help :)
// Enter your code below
var results: [Int] = []
for multiplier in 1...10 {
print("\(multiplier) times 6 is equal to \(multiplier * 6 )")
}
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Bryce. Welcome to Treehouse.
For the first part of the challenge, you are only asked to create the for in
loop. You added a print
statement that was not asked for. Challenges are very strict. Often if you add more than what was asked, modify preloaded code, etc... you will get the "Bummer..."
So, all you need for Task 1 is
var results: [Int] = []
for multiplier in 1...10 {
}
Bryce Patrick
10,099 PointsBryce Patrick
10,099 PointsHey Jason,
Thank you for your response. I can get past task one but i cannot get past the second task. It keeps telling me that my range is off? Any ideas of how to pass this challenge? I've been stuck for quite some time lol.
Sincerely,
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsFor the second task, you only need to add one line of code inside the
for
loop. The challenge wants you toappend
the value of 6 multiplied by each multiplier. With each iteration of the loop, the multiplier will be different and we want to add to theresults
array. This is done with.append()
I would suggest, maybe, review the previous videos before moving on, because the loops get more complex and will move to
switches
andfunctions
. Without a complete understanding of these past few videos, the next section will be very difficult. I often review and rewatch before moving on.:)