I am familiar with the += operator in java, that if executed like:
i += 2;
is the same as:
i = i + 2;
But what exactly is =+? It compiles fine in Java, but as far as I can tell it only assigns the result right-hand-side expression to the left-hand-side variable. i.e.
i =+ 2
is the same as:
i = 2
Anyone know what exactly is going on here? Apologies if this has been asked, the SEO for any question regarding operators is always wonky... Thanks!
i =+ 2
is the same as
i = +2;
i.e., the +
is the unary +
operator.
i =+ 2
is equivalent to i = +2
where +
is the unary plus operator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With