0

How does "i--" differ from "--i" in c#? is this the same? it seems to equate to the same thing.

i--;

other answers seem to say i++ or ++i, but i am asking about i-- or --i

Your Momma
  • 41
  • 1
  • 3

1 Answers1

3

--i decrements the variable i BEFORE an operation, i-- after. makes a big difference in, for example,

int i=5;
Console.WriteLine(--i);

i=5;
Console.WriteLine(i--);