3 ms·
I don't understand why `a += b` is called binary (I agree!) but `a f= b` would be called ternary. I guess it's thinking of `f` as one of the arguments?
by JadeNB 2y ago
I don't understand why `a += b` is called binary (I agree!) but `a f= b` would be called ternary. I guess it's thinking of `f` as one of the arguments?
- Izkata 2y agoThe way they described it, "f" can be almost any function, so it's the third argument to "=", while "+=" in most languages you can't replace "+" with anything - those are a specific collection of two-character operators.
- extraduder_ire 2y agoWhat binary infix operator can't the + in += be replaced by? I can't think of any. /,*,-,%,^,||,&&,|,& all work. I guess = is taken by another symbol, but that does assignment all on its own.
- Izkata 2y agoThey're describing "+=" as a single operator, not a combination. "-=" is a different single operator, as is "/=" and and all the others. The first character and the "=" are inseparable, they just have all the combinations defined as independent operators. They're comparing it to a language where the first part (which can be multiple characters!) is actually separate from "=".