3 ms·
I remember this from a similar example in C: #include <stdio.h> int main() { int x = 10; while (x --> 0) /* x goes to 0 */ {
by lower 9y ago
I remember this from a similar example in C:
#include <stdio.h>
int main()
{
int x = 10;
while (x --> 0) /* x goes to 0 */
{
printf("%d ", x);
}
}
(prints 9 8 7 6 5 4 3 2 1 0)
https://stackoverflow.com/questions/1642028/what-is-the-operator-in-c https://stackoverflow.com/questions/1642028/what-is-the-oper...
- fiddlerwoaroof 9y agoYour description of the result is a valid Lisp expression. . .As long as one has defined a prints function.
- jfktrey 9y agoWorks just as well in Java. I'll have to slip this in to my next code review :)
- beeforpork 9y agoCareful with these jokes -- your coding style nazis will give you a new coding rule in return to prevent this madness in the future!
- mcguire 9y agoOr, worse, adopt it as the way to do things. I blame Haskell, Scala, and Ruby.
- lower 9y ago> Or, worse, adopt it as the way to do things. Thompson, Ritchie and Kernighan admit that Unix was a prank http://www.stokely.com/lighter.side/unix.prank.html http://www.stokely.com/lighter.side/unix.prank.html
- deleted 9y ago[deleted]
- repsilat 9y agoYeah, `x --> 0` works. Also `0 <-- x` if you don't want to include zero (and `x --- 0` if you don't have a shift key.)