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

Richard Barquero
Richard Barquero
474 Points

Using the append method to add to an array.

Please review my code and inform why line 2 is being rejected.

array.swift
var arrayOfInts = [1,2,3,4,5,9]
arrayOfInts.append(19,27)
arrayofInts = arrayOfInts + (42,47)

1 Answer

dandan1987
seal-mask
.a{fill-rule:evenodd;}techdegree
dandan1987
iOS Development with Swift Techdegree Student 285 Points

Hi Richard,

I believe line 2 is being rejected because your trying to append 2 Ints into the array instead of 1. Simply remove the Int 19 and you should be good. The same for line 3, it only needs 1 Int.

Take your time learning and have fun :)