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

What's wrong with this append code?

Trying to figure out why this challenge is throwing an error for the following code.

todo.append("Debug App")

I'm try to append the following list:

var todo = ["Learn Swift,", "Build App", "Deploy App"]

with todo.append("Debug App"). Seems to work fine in Xcode but when I try to do this on challenge it is saying I have the wrong value(???).

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

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Varghese,

The task asks you to append 2 items which are Debug App and Fix Bugs, the code you should have is as follows.

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

Happy coding!

Thank Chris. That worked. I got hung up on the error message and failed to try to add two appends consecutively.