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 trialCesar Gonzalez
614 Pointscontrol flow SWIFT: Dont understand what is wrong with my code.
// Enter your code below
var results: [Int] = ["6","12","18","24","30","36","42","48","54","60"]
for multiplier in 1...10
{ print("\(multiplier) times 6 is equal to \ (multiplier* 6)") "}
2 Answers
swiftlover
1,597 Pointsvar results: [Int] = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60]
for multiplier in results {
print("\(multiplier) times 6 is equal to \(multiplier * 6)")
} Don't write numbers in "" when u have assigned type as Int. "" is used for type String
Cesar Gonzalez
614 Pointsi just figured the proper way var results: [Int] = [] results.append(6) results.append(12) results.append(18) results.append(24) results.append(30) results.append(36) results.append(42) results.append(48) results.append(54) results.append(60)
for multiplier in 1...10 { print("(multiplier) times 6 is (multiplier * 6)") }
, anyways , thanks to the people willing to support me. Thanks homies.