Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
invert sense of ? with compound assignment #969
However, prior to this commit, the code
Contrast with accessignment, where
This commit makes
Technically a breaking change, but I don't see how the feature would have been put to any good use before, so I'm treating this as a minor bug fix and waiting one week before merging on June 26, unless, as always, there are objections.
actor.health ?+= 10
increments actor’s health if it exists (even if it's 0), whereas
actor.health &&+= 10
only does so if actor has a nonzero health.
I feel like there are at least as many, if not more, use cases for the former as for the latter.
Again, I'm shooting for consistency with what accessignment does: compare
That seems like a completely independent question—or am I missing your point? Even with the explicit dot,