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

Mika Kiela
Mika Kiela
2,178 Points

Hi, fellas! I don't get this third task.

I think I have done everything right, but it just doesn't work. Any help? The question was about reading from arrays.

array.swift
var arrayOfInts: [Int] = [1,2,3,4,5,6]
arrayOfInts.append(7)
arrayOfInts += [8]
let fifthValue = arrayOfInts[4]

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing great, but you seem to have missed part of the instructions. Your code is actually just fine, but you misnamed the constant so now it can't find the constant it's looking for. You did, however, manage to assign the correct value so kudos! :thumbsup:

You named your constant fifthValue but the variable must be named value for the challenge to pass. The challenges are extremely strict.

Take a look:

let value  = arrayOfInts[4]

Happy coding! :sparkles:

Mika Kiela
Mika Kiela
2,178 Points

Thank you Jennifer!