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 trialBrandon Sherwood
611 Pointswhat am i doing wrong with my syntax?
what can i correct on my syntax?
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append ("Debug App", "Fix Bugs")
3 Answers
Jhoan Arango
14,575 PointsHello Brandon :
You are doing well. One detail that I am not 100% sure they explained it in the video is that the append() method, only adds ONE item at a time, and this item goes into the end of the array.
But thankfully there are other ways to add 1 or more items at the same time.
If you want to pass this challenge you can do the following codes.
// First solution
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append ("Debug App")
todo.append("Fix Bugs")
// Second solution is to use the addition assignment operator +=
todo += ["Debug App","Fix Bugs"]
Hopefully this helps you a bit
Good luck and Happy Coding
Raymond Yeh
2,965 PointsTry ending semi colons to the end of every line.
Steven Deutsch
21,046 PointsHey Brandon Sherwood,
I think you have to append each individually. I think this is because append only accepts one parameter, but I'm still learning myself!
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")
Let me know if this helps. Good luck!
Jhoan Arango
14,575 PointsGood answer !
Steven Deutsch
21,046 PointsSteven Deutsch
21,046 PointsHey Jhoan,
I love that second solution! Good to know.
Thanks!