Why Isn't 'Puts' Used in Applications?

210 views Asked by At

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.

1

There are 1 answers

1
Miguelgraz On BEST ANSWER

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.