ruby - Function name followed by assignment operator -


this question has answer here:

what following function definition mean? why there assignment operator in function name?

def func=(param)   @param = param end 

what following function definition mean?

they called writer method in ruby.

why there assignment operator in function name?

it adds sugar in syntax.

while have method as

def func=(param)   @param = param end 

you can call normal assignment

ob.func = 12 # same obj.func(12) 

Comments

Popular posts from this blog

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

double exclamation marks in haskell -

javascript - How to get D3 Tree link text to transition smoothly? -