• computergeek125@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    5 months ago

    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.