3 ms·
C++ does not have boolean assignment operator in a sense the ||= syntax works in ES. https://www.w3schools.com/cpp/trycpp.asp?filename=demo_oper_ass8 https://w
by megous 5y ago
C++ does not have boolean assignment operator in a sense the ||= syntax works in ES.
https://www.w3schools.com/cpp/trycpp.asp?filename=demo_oper_ass8 https://www.w3schools.com/cpp/trycpp.asp?filename=demo_oper_...
||= will not assign anything unless the LHS variable is falsy. It will not even evaluate the right side unless LHS is falsy.
|= will work the same in C++ and ES mostly (depending on types)
- HWR_14 5y agoI'm just thrown for a loop. Why is the default to assume I'm familiar with the ||= operator in ES? The fact that the ||= operator short circuits makes sense from an optimization point of view. I will maintain that there is no good use for the correctness (as opposed to optimization) of the code to depend on that feature.