top of page
Search

Prefix and Postfix increments in C#

  • Admin
  • Jun 23, 2024
  • 1 min read

Example at belows show prefix and postfix increments in C#.



int x = 5;


Console.WriteLine("x: {0}", x); //Output x: 5


Console.WriteLine("x++: {0}", x++); // Output x: 5


Console.WriteLine("x: {0}", x); // Output x: 6 



int x = 5;


Console.WriteLine("x: {0}", x); // Output x: 5


Console.WriteLine("++x: {0}", ++x); // Output x: 6


Console.WriteLine("x: {0}", x); // Output x: 6 




Commentaires

Noté 0 étoile sur 5.
Pas encore de note

Ajouter une note

© 2023

 
bottom of page