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

John Moron
John Moron
1,658 Points

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

What am I doing wrong?

arrays.swift
var todo = ["Learn Swift","Build App","Deploy App"]
todo.append: [String] = ["Debug App","Fix Bugs"]

2 Answers

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

Hi, John Moron , if you wanna append everything in one line, then change your last line to

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

with +=, you can merge two list into one.

Logan R
Logan R
22,989 Points

There are a few different ways to do this but one you can try is to append them one at a time.

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

I tried doing it this way, Although correct, it doesn't appear to want this answer