Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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: