Answer the question
In order to leave comments, you need to log in
How can you use = methods in Ruby?
I'm learning Ruby, after C++, I don't understand the following method=, is it a call to the method method and the value is immediately assigned to the object? or how to interpret it?
Answer the question
In order to leave comments, you need to log in
Yes, this is a setter, quite simply :)
Ruby allows you to use some characters in method names.
Therefore, there are valid?, select! methods.
object.value = 10 is the same as object.value=(10), which in C++ would be object.setValue(10)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question