Skip to content
DevMeme
2281 of 7590
Languages Post #2538 · source on Telegram

Cursed Ways to Increment X

Description

A tall multi-panel Spider-Man meme starts with three Spider-Men pointing at each other, labeled `x++`, `x = x+1`, and `x += 1`. Below, increasingly distorted Spider-Man drawings are paired with stranger equivalent-looking expressions: `x -= -1`, then `x *= 1 + 1 / x;`, and finally `x /= x / (x + 1);`. The technical joke is that many expressions can mathematically increment a value by one, but each rewrite gets less readable, more fragile, and more likely to break on edge cases such as zero or numeric precision.

Comments

8
Anonymous ★ Top Pick The last one increments `x` and the probability that code review becomes a wellness intervention.
  1. Anonymous ★ Top Pick

    The last one increments `x` and the probability that code review becomes a wellness intervention.

  2. @sylfn 5y

    x /= x / (x - -1)

  3. @sylfn 5y

    just because when x == "2": x + 1 = 21

  4. @sylfn 5y

    anx x - -1 equals to 3

  5. @sylfn 5y

    we can substitute -1 by some shit like cos(4atan(1))

  6. @dwanford 5y

    didn't work when x integer

    1. @dwanford 5y

      3 case, i mean

    2. @Stepan_Poznyak 5y

      x *= 1 + 1.0 / x

Use J and K for navigation