Put and print


#1

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

Note

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


#2

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.


#3

Ok, thanks!:grinning:


#4

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