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 trialMikhail Pronin
861 PointsMy code doesn't work! Please, help!
Retrieve the 5th item (remember array indexes start at 0) and assign the result to a constant named value.
What's wrong with the code?
// Enter your code below
var arrayOfInts: [Int] = [10,15,20,25,30,40]
arrayOfInts.append(55)
arrayOfInts += [1]
let fifthItem = arrayOfInts[4]
1 Answer
Jennifer Nordell
Treehouse TeacherHi, Mikhail! Your code is syntactically fine, however, it does not meet the requirements of the challenge instructions. The instructions state to retrieve the fifth item and assign it to a constant named value
, but you've named your constant fifthItem
. Simply changing the constant name from fifthItem
to value
will cause this to pass Step 3.
Hope this helps!