Hello everyone. I'm a newbie with a question whose answer is probably
obvious, but I'm too thickheaded to figure it out, so here goes...
We can say "cba".reverse or x.reverse and get "cba". Also x.upcase or
"abc".upcase and get "ABC".
So it's pretty clear that x and "abc" are objects, because we're able to
use methods to send messages to them.
But when I do x.print or "abc".print it throws an error. I have to use
print x or print "abc", which seems to violate the "least surprise"
principle and causes sleep deprivation in clueless newbies like me.
Also,
things like print x.upcase.reverse just drive me up a wall. Why not
x.upcase.reverse.print?
Can anyone help?
···
--
Posted via http://www.ruby-forum.com/.