문제

I've noticed that not many applications I have started tutorial's with use the 'puts' method (not sure if it is a method, or what it is called exactly); however, in this tutorial, I'm using it simply to learn the fundamentals of Ruby- what is used usually, instead?

Thanks.

도움이 되었습니까?

해결책

puts method is essentially a "print to_s", which receives an object (number, string, etc) tries to convert it to string and then print it.

Since most of the ruby apps are web it is rare to see it being used on these ones, where we can just use a variable in a html/erb template, however it is usually used in ruby scripts, rake tasks and other kind of stuff that relies just on terminal.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top