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

double exclamation marks in haskell -

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

Qt Creator - Searching files with Locator including folder -