Advertisement
HristovJ

i++ / ++i example in for loop

Nov 5th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.34 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4.     {
  5.         static void Main()
  6.         {
  7.             for (int i = 0; i < 10; i++) { Console.WriteLine(i); }
  8.  
  9.             // In c# there is no difference when used in a for loop.
  10.             // i++ is the same as ++i
  11.  
  12.             for (int i = 0; i < 10; ++i) { Console.WriteLine(i); }
  13.          }
  14.      }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement