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 trialBrian Uribe
3,488 PointsWhat am I doing wrong?
What is wrong with this line of code?
todo.append("Debug App", "Fix Bugs")
I try entering it into the computer for the challenge question and I keep getting it wrong. Not sure why.
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App", "Fix Bugs")
2 Answers
swiftlover
1,597 Pointsvar todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
///// OR/////
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo += ["Debug App", "Fix Bugs"]
I feel 2nd method is better.
eirikvaa
18,015 PointsYou're calling .append() with 2 arguments, when it only takes 1 argument. Break it down into two function calls with one argument each, and you're good to go.
Brian Uribe
3,488 PointsOh! Okay! Is there a way to do it with two arguments?
eirikvaa
18,015 PointsYou can do this:
var numbers: [Int] = [0]
numbers += [1, 2]
// numbers: [0, 1, 2]