Last Updated: February 25, 2016
·
221
· peterpengnz

Why variable names cannot have ? or ! in Ruby but method names can

I had this question and found a good discussion on StackOverflow

There is a difference as a variable holds a specific value whereas one single method could return values of different types. However, from a semantic point of view:

Methods are messages sent to an object, so you could tell the object do do something or ask it for a value (hence the question mark). Variables are just holding a certain value.