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 Collections and Control Flow Introduction to Collections Working With Arrays

Adrian Yao
Adrian Yao
1,002 Points

What does it mean i have to use the + operator?

I asked this once and I tried what the guy said, but it still doesnt work. Thanks for helping.

array.swift
// Enter your code below

var arrayOfInts = [1,2,3,4,5,6]

arrayOfInts.append (7)


var arrayofInts = arrayofInts + [8]
Matt Skelton
Matt Skelton
4,548 Points

You've got the logic spot on, so don't beat yourself up too much! The problem here is that you're creating a new variable named 'arrayofInts', whereas the task wants you to continue using the variable 'arrayOfInts'.

By concatinating the arrays and assigning it to your existing variable, you should satisfy the requirements of this task.

arrayOfInts = arrayOfInts + [8]

I hope this helps!