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

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -