Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
I forget where I originally found this and Google on my phone was unhelpful.
My favorite annoying trick is x -=- 1. It looks like it shouldn’t work because that’s not precisely a valid operator, but it functions as an increment equivalent to x += 1
It works because -= still functions are “subtract and assign”, but the second minus applies to the 1 making it -1.
I forget where I originally found this and Google on my phone was unhelpful.
My favorite annoying trick is
x -=- 1
. It looks like it shouldn’t work because that’s not precisely a valid operator, but it functions as an increment equivalent tox += 1
It works because
-=
still functions are “subtract and assign”, but the second minus applies to the 1 making it -1.