Put and print


Put and Print

In Ruby you use put and print. Is this similar to return and console.log in JavaScript. For example would this work in Ruby as it does in JavaScript?

x = put "hi".upcase
print x


This is not a problem with a project but just a question. :slight_smile:


Imagine if + printed the result instead of returning it

You'd be able to print the result of 1 + 1, but you wouldn't be able to evaluate 1 + 1 + 1, because there would be no result to do the second addition with - it was printed instead.


Ok, thanks!:grinning:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.