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 trialMitchell Joshua Sutjitra
12,749 Pointsfor num in 1...10 { println("\n\(num) * 7 = \(7*num) ") } what's wrong with my code here?
for num in 1...10 { println("\n(num) * 7 = (7*num) ") }
what's wrong with my code here?
They said... You didn't println the right values. You printed [ 1 * 7 = 7 , 2 * 7 = 14 , 3 * 7 = 21 , 4 * 7 = 28 , 5 * 7 = 35 , 6 * 7 = 42 , 7 * 7 = 49 , 8 * 7 = 56 , 9 * 7 = 63 , 10 * 7 = 70 ], but we were looking for [1 * 7 = 7, 2 * 7 = 14, 3 * 7 = 21, 4 * 7 = 28, 5 * 7 = 35, 6 * 7 = 42, 7 * 7 = 49, 8 * 7 = 56, 9 * 7 = 63, 10 * 7 = 70].
for num in 1...10 {
println("\n\(num) * 7 = \(7*num) ")
}
1 Answer
Sage Elliott
30,003 PointsHello! you just need to remove that new line(\n) and it should pass! Printin puts everything on a new line and doesn't need it!
Mitchell Joshua Sutjitra
12,749 PointsMitchell Joshua Sutjitra
12,749 PointsThanks a lot!
Sage Elliott
30,003 PointsSage Elliott
30,003 PointsAnytime! :D