X = 1 + 1 X = 1 1 X = 1 * 1 X = 1 / 1
However, occasionally will you see something a little out of the ordinary, usually in languages that borrow some of their syntax from C. In Ruby, they're called multiple assignments; I like to think of them as less typing. Consider, for a moment, the following line of code:
X = X + 5
All that it does is increment the variable X by 5, so wouldn't it be easier to type this instead?
X += 5
Yeah, all that I'm saving is two keystrokes, the second X and a space, but it adds up. Imagine for a moment the variable name was my last name, Woychowsky instead of X. Having to type it only once would greatly extend the life of the W key. The same shortcut is available for subtraction, multiplication, and division.