Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
645 views
in Technique[技术] by (71.8m points)

ruby - What does "+=" (plus equals) mean?

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 learning new methods. The problem is, I have no idea what += means when I tried to look it up online.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

+= is a shorthand operator.

someVar += otherVar

is the same as

someVar = someVar + otherVar

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...