samedi 27 août 2016

what are the difference in ruby methods

What are the difference of the following method and how do it function/works?

method(x)

def method(x)
  # some codes
end  

method=(x)

def method=(x)
  # some codes
end

==(x)

def ==(x)
  # some codes
end

I kwow how method(x) works, it is a method with a required parameter. But I don't know how other methods works and when and how to use. Also I don't know the difference. Can someone explain it for me?

Thanks!

Aucun commentaire:

Enregistrer un commentaire