Using prefix in comparison will change the value before expression evaluation, where using postfix will change value after expression evaluation. Look at below example.
You can look into example in dotnetfiddle - https://dotnetfiddle.net/txxcEa
public static void Main() { // Prefix and Postfix example int x = 5; if(++x == 6) { Console.WriteLine("Using prefix will increment value before expression is evaluated."); } Console.WriteLine(string.Format("Value of x is {0}", x)); if(x++ == 7) { // we will never reach this code as expression is evaluated before increment, hence x is still equal to 6 Console.WriteLine("I am here but you will never see me in console."); } Console.WriteLine(string.Format("Value of x is {0}", x)); }
You can look into example in dotnetfiddle - https://dotnetfiddle.net/txxcEa
Thank you very much for shared this. I got lot of ideas after reading this. Share more as similar to this.
ReplyDeletecore java training in chennai
core java training institutes in chennai
core java Training in Velachery
C C++ Training in Chennai
javascript training in chennai
Appium Training in Chennai
JMeter Training in Chennai
core java training in chennai
Great Article. Thank you for sharing! Really an awesome post for every one.
ReplyDeleteIEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.
JavaScript Training in Chennai
JavaScript Training in Chennai