C Sharp :: Condition in loop is valid? A bit strange to me?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int number = 0; int counter = 0; while (counter <= 2) { number++; Console.WriteLine("loop numbvar++ post increment : " + number); Console.WriteLine("loop counter++ post increment: " + counter); counter++; if (counter == 3) // Question: why is this condition true? the loop shall work until <=2 is true.... { Console.WriteLine("Counter is : " + counter); } } // Console.ReadKey(); } } }