Hm, playing devil’s advocate, I think it is because the minus has not been defined as a string operation (e.g. it could pop the last char), so it defaults to the mathematical operation and converts both inputs into ints.
The first is assumed to be a concat because one of the parcels is a string…
It’s just doing a lot of stuff for you that it shouldn’t be in first place 🤭
Hm, playing devil’s advocate, I think it is because the minus has not been defined as a string operation (e.g. it could pop the last char), so it defaults to the mathematical operation and converts both inputs into ints.
The first is assumed to be a concat because one of the parcels is a string…
It’s just doing a lot of stuff for you that it shouldn’t be in first place 🤭
Yeah, this looks dumb on the surface, but you’ve got bigger problems if you’re trying to do math with strings
Yup. It’s completely inconsistent in its interpretation of the + operator.
Yeah, I actually had to try 1+“11” to check that it didn’t give me 12, but thankfully
it commutesit’s consistent 😇Maybe the behaviour with regard to type conversion, but not for the operation itself.
“13”+12 and 12+“13” don’t yield the same result.
Nor would I expect “1312” to equal “1213”… Still that operator with these operands should just throw an exception