I'm having trouble understanding the function of the equals sign in the following method:
@name = value
The text says that this is just Ruby convention, but I've experimented with it a bit, and it clearly changes the function of the code. With this short program:
greeting = "hello" def a_method(value) value = value + " there." return value end puts a_method(greeting)
...I get "hello there," but if I do THIS...
greeting = "hello" def a_method=(value) value = value + " there." return value end puts a_method=(greeting)
... I only get "hello". What is actually going on here? What does that ' = ' sign do? Thanks in advance!