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

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 50,905 Points

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
STAFF
Jennifer Nordell
Treehouse Staff

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: