It is possible to initialize multiple variables to the same value a=b=5
. Also, it is possible to add to a variable with a+=2
. But is there any way to add the same value to both at the same time? Something like this a+=b+=2
without the a
getting incremented by the value of 2
and b
. So in this case both a
and b
would end up being 7.
Also, I'm not looking for an answer that repeats the added value such as a+=2,b+=2
.
I realize this is not the greatest coding practice I just wondered if it was possible. Somewhat similar in nature to Swapping two variable value without using 3rd variable