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

Ruby Ruby Collections Ruby Arrays Accessing Items in Arrays

There is a bug here

my answer is correct the site has a bug

array.rb
grocery_list = ["milk", "eggs", "bread", "ice cream", "potatoes", "pie"]
last_item = grocery_list.last

2 Answers

There is a note on the page: Important: In each task of this code challenge, the code you write should be added to the code from the previous task.

Your code for the second task is fine but it needs to be added to the code for the first task.

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

Hi there! You are partially correct! Your code is correct, but it is only correct for Step 2. You have removed the code from Step 1. These tasks are cumulative. The code you wrote in Step 1 should not be erased unless explicitly told to do so. Check out this informational message marked as "important" in the place where the Bummer! will appear after hitting "Check Work".

Important: In each task of this code challenge, the code you write should be added to the code from the previous task.

Replacing your working code from Step 1 and adding this piece to it, your code passes with flying colors!

Hope this helps! :sparkles: