for and while loop in c#
(update) Actually – there is one scenario where the for construct is more efficient; looping on an array. The compiler/JIT has optimisations for this scenario as long as you use arr.Length in the condition: for(int i = 0 ; i < arr.Length ; i++) { Console.WriteLine(arr[i]); // skips bounds check } In this very specific … Read more