29
Comments
  • 0
    Doesn't really matter unless you assign that to another variable at the same time (and you probably shouldn't do that anyway).
  • 6
    ++x is the only right way
  • 0
    When paid for number of lines:
    x = x.getCounter()
    .add(new Number()
    .setValue(1)
    )
    );
  • 0
    x += (++x - x--) + ++x + ++x - 2 * --x
  • 0
    @s0LA
    ++x - x-- = 0

    ++x + ++x - 2 * --x = 1
  • 0
    @s0LA
    every time we x++/++x/--x/x-- we change the value of x (before or after using its value, depending if the sings are before or after the variable) and has to be taken into account for the remainder of the calculation

    x += (++x - x--) + ++x + ++x - 2 * --x
    x += ++x + ++x - 2 * --x;
    x += (x+1) + (x +1 + 1) - 2 * (x +1 + 1 - 1)
    x += 2x - 2x + 3 - 2
    x += 1

    is it confusing? yes, try to avoid complex sentences with those :P
Add Comment