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 trialParker Barandon
377 PointsCompiler error in Treehouse but not Xcode
So this code seemed to be following directions but it keeps saying compiler error no matter what... I put it into Xcode to see if the compiler error showed up there, but it did not. What might I do here besides skip the challenge?
// Enter your code below
var arrayOfInts = [1,2,3,4,5,6]
arrayOfInts.append(7)
arrayOfInts = arrayOfInts + [8]
arrayOfInts[4]
let value = 5
2 Answers
Joe Beltramo
Courses Plus Student 22,191 PointsInteresting that you don't get an error in Xcode. You are close though. The challenge is looking for you to assign the value in the array at the 5th index to a constant named value.
You clearly know how to create a constant named value and assign something to it:
let value = 5
And you correctly grabbed the 5th item in the array
arrayOfInts[4]
Now, just assign the arrayOfInts[4]
to the constant let value =
and get ride of the number 5
let value = arrayOfInts[4]
Jonathan Ruiz
2,998 PointsHi Parker I looked at the code you provided if it was for the third part of this challenge you need to assign the constant value to the call of the 5th item in the arrayOfInts
let example = testArray[3]