7.The '.length' Method


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-ruby/lessons/introduction-to-ruby/exercises/the-length-method?action=lesson_resume

<In what way does your code behave incorrectly? Include ALL error messages.>
I wrote
"Sam".length
puts

The exercice question becomes green , so right but however it doesn’t print the result ??? yet I put PUTS
why ?
Thanks all !


#2

Put them on the same line.

Why? You want to send the length of "Sam" out to the browser, but it’s on its own line.


#3

Hello Tonya !
thanks very much ! It worked .
I thought I have to write “puts” in the following line .
thanks !


#4

The exercice question becomes green , so right but however it doesn’t
print the result ??? yet I put PUTS
why ?

puts without argument just outputs a newline.

puts(5+6)

would output 11, followed by a newline.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.