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

java - How to print docx and pdf? -

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

java - IntelliJ to move a class along with conflicted classes to a new package? -