Hacker News new | ask | show | jobs
by gte910h 5418 days ago
If you insist on one line

    if (v>0) v=0; else v=1;
Otherwise

    if(v>0)
      v=0;
    else
      v=1;
Some of us prize readability over neat tricks. I think there are a 100 ways most of these answers could be misinterpreted by people. Code is read more than it is written, and programs rarely work better because you wrote it slightly more "impressively". Modern compilers do much of this sort of stuff that they are doing in this thread, but they do it in a repeatable manner which future programmers don't have to puzzle out.