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 trial

iOS Swift Basics (retired) Collections Modifying an Array

I have been asked to append the following strings: "Debug App", "Fix Bugs" to var todo.

this is my code: todo.append("Debug App", "Fix Bugs"). What's Wrong?

arrays.swift
var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App", "Fix Bugs")
Michael Pastran
Michael Pastran
4,727 Points

The thing with .append is that it only lets you add one item to the array at a time!!

so you have to do

todo.append ("Debug App") todo.append("Fix Bugs")

also make sure your not being asked to change one for the other!! so its not telling you that since you have bugs you need to fix them first. because then its a different code.. lol

1 Answer

You need to append each item on a new line.

var todo = ["Learn Swift", "Build App", "Deploy App"]
todo.append("Debug App")
todo.append("Fix Bugs")