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 trialJulio Apodaca
407 PointsI can't remove the sixth term
the task is asking for me to remove the sixth term of an array. the sixth term is the number 6 and the array goes [1,2,3,4,5,6,7,8] so to remove the sixth term i typed arrayOfInts(at: 5) and it works on xcode it does remove the number 6. but here its giving me a hint saying make sure i remove the sixth term from the index 5.
// Enter your code below
var arrayOfInts = [1,2,3,4,5,6]
arrayOfInts.append(7)
arrayOfInts + [8]
let value = arrayOfInts[4]
arrayOfInts.remove(at: 5)
let discardedValue = arrayOfInts
1 Answer
Thomas Dobson
7,511 PointsHI Julio,
You did all the hard stuff right!
You didn't properly set your constant discardedValue to the 5th removed index. It should have been like this:
// Enter your code below
var arrayOfInts = [1,2,3,4,5,6]
arrayOfInts.append(7)
arrayOfInts + [8]
let value = arrayOfInts[4]
let discardedValue = arrayOfInts.remove(at: 5)
Eunice Torres
2,278 PointsEunice Torres
2,278 PointsHow come its wants it this way and not the way julio set?