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 trialZachary Berling
10,703 PointsWhat value and how do I append it? .append() method or the += operator. where do I get the value? Thanks for help :D
This is as far as I've gotten with it i've tried many things but I'm having no luck atm...
// Enter your code below var results: [Int] = [6] for multiplier in 1...10 { print("(multiplier) times 6 is equal to (multiplier*6)")
}
// Enter your code below
var results: [Int] = [6]
for multiplier in 1...10 {
print("\(multiplier) times 6 is equal to \(multiplier*6)")
}
3 Answers
Zachary Berling
10,703 PointsI figured it out Nevermind lol
Josue Gisber
Courses Plus Student 9,332 PointsWhat did you do? I'm stock
james white
78,399 PointsIn case Josue is still stuck...
I went with this code:
var results: [Int] = []
for multiplier in 1...10 {
print("\(multiplier) times 6 is equal to \(multiplier*6)")
results.append(multiplier*6);
}
...which was based on a slight modification of the
'results.append' code that Steve Hunter (Mod) showed in this forum thread:
https://teamtreehouse.com/community/how-to-find-multiplies-of-7
Josue Gisber
Courses Plus Student 9,332 PointsThanks man, it worked for me! Thanks for the help
Brian Patterson
19,588 PointsThanks for that James. I am finding the challenges in this section confusing.
Zachary Berling
10,703 PointsEnded up using the += operator with the results from the loop for the value.
james white
78,399 Pointsjames white
78,399 PointsThis code passes Challenge task 1 of 2,
but fails on for Challenge task 2 of 2, giving: