What does “+=” (plus equals) mean?

前端 未结 4 1079
滥情空心
滥情空心 2020-12-09 01:43

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

4条回答
  •  一向
    一向 (楼主)
    2020-12-09 02:31

    += is a shorthand operator.

    someVar += otherVar
    

    is the same as

    someVar = someVar + otherVar
    

提交回复
热议问题