fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int x, y = 5; // y = 5;
  8. Console.WriteLine(y);
  9.  
  10. x = ++y * 2; // y = 6 (bo ++y zwieksza poprzednia wartosc o 1), x = 6 * 2 = 12
  11. Console.WriteLine("{0}\t{1}", x, y);
  12.  
  13. x = y++; // y = 7, x = 6 (bo operator post zwraca 'stara' wartosc)
  14. Console.WriteLine("{0}\t{1}", x, y);
  15.  
  16. x = y--; // y = 6, x = 7 (jw.)
  17. Console.WriteLine("{0}\t{1}", x, y);
  18.  
  19. Console.WriteLine(++y); // y = 7, x = 7
  20. Console.WriteLine("{0}\t{1}", x, y);
  21.  
  22. Console.ReadKey();
  23. }
  24. }
Success #stdin #stdout 0.03s 24256KB
stdin
Standard input is empty
stdout
5
12	6
6	7
7	6
7
7	7