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