4 ms·
See also the long right arrow, or "goes to" operator --> (https://stackoverflow.com/questions/1642028/what-is-the-operator-in-c-c https://stackoverflow.com/ques
by Sharlin 3y ago
See also the long right arrow, or "goes to" operator --> (https://stackoverflow.com/questions/1642028/what-is-the-operator-in-c-c https://stackoverflow.com/questions/1642028/what-is-the-oper...)
- alejohausner 3y agoThere’s also the “comes from” operator: while (x < — - 10) { … } In fact, you can make arrows longer: while (x <— — — — - 10) And you can make thicker arrows with plus signs: while (x ++++> 10) (hmmm… the HN text formatter is fighting me. Those are all minus signs)
- wruza 3y agoPrepend two spaces to turn a paragraph into a code block which leaves the text as is. Not code -- Code -- (“ Code --”)
- layer8 3y agoHN doesn't do that. It is your browser or (more likely) the standard text input of your OS.
- WalterBright 3y agoI like the ...___... operator when your code is sinking.
- jeroenhd 3y agoSee also: the tadpole operator (https://devblogs.microsoft.com/oldnewthing/20150525-00/?p=45044 https://devblogs.microsoft.com/oldnewthing/20150525-00/?p=45...) Returns x+1 or x-1 depending on the direction the tadpole swims (-~x to increment x and or ~-x to decrement x). For a short moment I believed this was a real thing, because my programming font has a special ligature for ~- and -~.
- omoikane 3y agoIt's actually useful in a code golf context, because "x * -~y" is two characters shorter than "x * (y + 1)".
- layer8 3y agoNote that "increment" and "decrement" normally refer to changing the value of a variable (what ++ and -- do). It would have been funny if C had defined -~= and ~-= as the increment and decrement operators.
- jeroenhd 3y agoFair enough. I suppose you would need to write something like `x=~-x` to actually perform an increment on the variable.