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 trialChristopher Chin
248 PointsSorry... you are WRONG. The first quotation mark is followed by a newline, and thus the string will include four lines
Sorry... you are WRONG. The first quotation mark is followed by a newline, and thus the string will include four lines - the first of which is blank.
1 Answer
Kevin Korte
28,149 PointsGood eye, Chris.
For anyone wondering, this is the question:
The following code would create a valid string in Ruby with 3 lines in it:
string = "
My Ruby string here
Is created in three lines
This is a haiku"
And it's a true or false answer. The only accepted answer is true. However, if you go into workspaces, create a ruby file and add that code in, and than run the file, the console returns
|
My Ruby string here
Is created in three lines
This is a haiku
(pipe character just to hold the empty line, it's not actually there in the program)
and further, if you add puts string.lines.count
it returns 4
, so it is a valid string, but it creates 4 lines not 3, thus the quiz answer should only accept false as being correct.
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsI'm not sure I understand what it is you are wanting to know/asking?