Ruby Code Return

What will this Ruby code return?

answer = "runthisnafleogw" p answer[0..2] p answer[3..6] p answer[5..5]+answer[7..7] p answer[8..8] p answer[9..9]+answer[5..5]+answer[10..11] p answer[3..3]+answer[12..12] p answer[13..13]+answer[11..11]+answer[3..3] p answer[3..4]+answer[11..11] p "answer"

What will this Ruby code return?

answer = “runthisnafleogw”

p answer[0…2]

p answer[3…6]

p answer[5…5]+answer[7…7]

p answer[8…8]

p answer[9…9]+answer[5…5]+answer[10…11]

p answer[3…3]+answer[12…12]

p answer[13…13]+answer[11…11]+answer[3…3]

p answer[3…4]+answer[11…11]

p “answer”

Srinivas, it will return the result of the last statement executed. In this case, it will

return the string “answer”. Things like this is easily verified within IRB console.

Good luck,

-Conrad

Hi --

Thank You Conrad.,

In Ruby there is a command called ‘require’. Explain what this command means and write an example of how it is used to include a Ruby Gem in a file.

can you guide me in getting the answer.

Dude, you really need to stop asking the rails community to do your homework.