Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Collections and Control Flow Introduction to Collections Working With Arrays

Yun Yin Ku
Yun Yin Ku
1,493 Points

Can't solve the assigning 'arrayOfInts' quest

how do I solve this quiz?? Can anyone help me?

array.swift
// Enter your code below
var arrayOfInts = [0, 1, 2, 3, 4, 5, 6]
arrayOfInts.append(7)
[0, 1, 2, 3, 4, 5, 6] + [7]
arrayOfInts[4]
let arrayofInts[4] = noObj

1 Answer

Gavin Butler
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Gavin Butler
iOS Development with Swift Techdegree Graduate 15,489 Points

Hi Yun Yin Ku,

I think the challenge asked for a starting array with 6 elements. That might be tripping it up. Also, when you concatenate an element, you need to assign it back to the array. Try arrayOfInts += [7] For the removal of an element, the challenge asks you to assign it to a constant called 'discardedValue' so start with let discardedValue = then use the .remove method on the array. hope this helps...