185 reputation
4
bio website curiouslynerdy.com
location United States
age 36
visits member for 3 years, 5 months
seen Dec 13 at 17:53

Dec
12
comment Why there are no compound assignment operators for logical operators (such as ||, && etc)?
I think you misunderstand the meaning of "mathematical", perhaps you have heard of boolean algebra. I agree the coercing a non-boolean in order to use ||= as a null coalescing operator is not intuitive and in fact looks obtuse in code-form. Where it does become useful is when you are attempting to do boolean math. function fulfill(inValue) { if(resolved || rejected) return false; /* Do stuff here */ return true; } resolved ||= fulfill(value)