Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top