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 trial

Ruby Ruby Basics (Retired) Ruby Strings What are Strings?

Fidel Torres
Fidel Torres
25,286 Points

Wrong anwser in Quiz!!!

this is the code in the quiz\

string = "
My Ruby string here
Is created in three lines
This is a haiku"

print string

question is if it creates 3 lines with text. -x-TRUE FALSE

the admited anwser is true, but it does create 4 lines:

______________________#this empty one you did not counted!!! My Ruby string here Is created in three lines This is a haiku

1 Answer

Justin Horner
STAFF
Justin Horner
Treehouse Guest Teacher

Hello Fidel,

The string the code produces contains three new line escape sequences like this.

"\nMy Ruby string here\nIs created in three lines\nThis is a haiku"

The quiz is correct because it is asking if it creates three lines of text, and indeed it does. The beginning is an escape sequence, which does not product a line of text.

I hope this makes sense.