I am doing some ruby exercises and it said I need to go back and rewrite the script with += shorthand notations.
This exercise deals primarily with lear
Expressions with binary operators of the form:
x = x op y
Can be written as:
x op= y
For instance:
x += y # x = x + y
x /= y # x = x / y
x ||= y # x = x || y (but see disclaimer)
However, be warned that ||= and &&= can behave slightly ... different (most evident when used in conjunction with a hash indexer). Plenty of SO questions about this oddity though.
Happy coding.