8

Even for the binary and & there is a shorthand operator &=.

So, why did the developers decide against something like a &&= b which would do a logical and assignment?

It would do the same like for example the += operator (a += b) would do to a = a + b, shortening the expression.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
  • What is that operator and in which language is it used? – Uma Kanth Jun 12 '15 at 12:13
  • @TagirValeev True, it could be a short-circuit assignment. It would of course potentially avoid only one evaluation, whereas `&&` has potential to avoid several. – Kayaman Jun 12 '15 at 12:20

0 Answers0