Increment and Decrement : Prefix Postfix Operator : Operator C# Examples


C# Examples » Operator » Prefix Postfix Operator »

 

Increment and Decrement





The ++ and the -- are the increment and decrement operators.
The increment operator adds 1 to its operand, and the decrement operator subtracts 1.




    
x  =  x  +  1;
    
   
  
   

can be written as




    
++x;  //  prefix  form
    
   
  
   

or as




    
x++;  //  postfix  form
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Operator
» Prefix Postfix Operator