What happens when you encounter a Continue statement inside the for loop?
Cristopher Coronado
Select an image from your device to upload
If you place a continue statement inside a ‘for’ loop, then code execution will move to next iteration by skipping all the lines of code after ‘Continue’ statement.EX:for(int i=0; 1<5; i++) { if(i==3) { continue; } Console.WriteLine(i.ToString()); }
Output:1245
Explanation: In third iteration code execution will be skipped once it enters into If condition and donot execute Console.WriteLine(i.ToString());