Using `+=` with `send` method

ruby, send

Solution

I'm afraid you cannot. `+=` is not a method, but rather syntactic sugar.

See http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_expressions.html

It says

In common with many other languages, Ruby has a syntactic shortcut: a=a+2 may be written as a+=2.

Best you can do is:

>> a = 20
=> 20
>> a = a.send "+", 10
=> 30
>> a
=> 30

Problem

How can one use `send` with `+=`? ``` a = 20; a.send "+=", 10 undefined method `+=' for 20:Fixnum a = 20; a += 10 => 30 ```

Original source