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 Adding Items to Arrays

Please Help

Challenge Task 2 of 2

Using the unshift method, add the string "celery" to the beginning of the array. Oops! It looks like Task 1 is no longer passing. Get Help Recheck work Go to task One array.rb

grocery_list = ["milk", "eggs", "bread"] grocery_list >> "carrots" array.unshift ("celery")

grocery_list = ["milk", "eggs", "bread"]
grocery_list >> "carrots"
array.unshift ("celery")

2 Answers

Hi Lacie,

You are close to passing this challenge! When adding "carrots" to the array you need to use "<<". To pass the next step you need to specify which array you want to use the "Unshift" method on which in this case would be grocery_list

grocery_list = ["milk", "eggs", "bread"]
grocery_list << "carrots"

Thank you!