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

We need to append a few more items to our todo array. Append the following strings: "Debug App", "Fix Bugs".

My Answer:

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

Its giving me an error message, I don't know why.

3 Answers

Mike NZ
Mike NZ
2,415 Points

Hi Umair,

The .append method only accepts one parameter, and therefore it isn't as simple as adding more terms inside the parenthesis.

To add more, have your code as follows:

todo += ("Debug App", "Fix Bugs")

The += term adds the items in the parenthesis to your todo array.

Hopefully this helps!

Michael Battle
Michael Battle
1,024 Points

this is correct except you will use [] not ()

so it will be:

todo += ["Debug App","Fix Bugs"]

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

todo += ["Debug App", "Fix Bugs"]