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 trialJim Harrold
2,927 PointsThink it's bugged. Tried Array.new(), Array.new[], Array.new(array), Array.new[array], array = Array.new. Still stuck.
I think this question is bugged. I've tried multiple different ways to start a new array (some I'm sure are even right, ha!) and it keeps giving the error message about using the new String method.
5 Answers
Amanda Wagner
6,070 PointsIt's asking you to instantiate a new instance of the Array class called array. So it wants array = Array.new.
Will Long
5,449 PointsI think that it is just "array.new"
Will Long
5,449 Pointsyou don't need to put the parenthesis at the end
Salman Akram
Courses Plus Student 40,065 PointsHi Jim,
No it is not bugged, I even tried to test it as it is passed. :)
String # 1
variable = string
class = String
method = new
Array # 2
variable = array
class = Array
method = new
Example:
string = String.new
array = Array.new
Andrew Stelmach
12,583 PointsThe answer to the first question in the Code Challenge is:
string = String.new
You probably knew that already, right? Well, when you answered the next question, you probably deleted the first answer. Don't - leave it there and add your answer underneath the first one. The complete code challenge will look like this:
string = String.new
array = Array.new
Jim Harrold
2,927 PointsWow, this one feels especially...picky, ha. Thanks everyone for your help!
Amanda Wagner
6,070 PointsAmanda Wagner
6,070 PointsI can see why you would be confused though, throwing the word array in there automatically makes you think it needs some brackets.