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 trialMatt Fiji
523 PointsRetrieving the 5th item of an array
I was able to find the 5th item on Xcode but on here I am getting an error. Help please :)
// Enter your code below
var arrayOfInts: [Int] = [1,2,3,4,5,6]
arrayOfInts.append(4)
arrayOfInts += [6]
arrayOfInts[4]
2 Answers
Jennifer Nordell
Treehouse TeacherYou did brilliantly actually. The problem is that you missed part of the instructions where it says to get the 5th element (which you did) and assign it to a constant named value: Here's the single line that needs to be changed:
let value = arrayOfInts[4]
By the way, did I mention challenges are picky? :)
Matt Fiji
523 PointsOHHH a constant named "value".. that totally went over my head! Thank you so much!!!
Jennifer Nordell
Treehouse TeacherYou're very welcome :)
Matt Fiji
523 PointsMatt Fiji
523 PointsThank You! so much!