0
Can any one explain this code. Please. Why output is 1,2,4
#include <iostream> using namespace std; int main() { for (int i=1;i<5;i++){ if(i==3) continue ; cout <<i <<","; } }
2 Answers
0
when i is 3, continue takes you through the loop again, skipping the cout statement. So you get just 1,2, and 4.
0
Scott, if there are many nested if inside this, how does it identify the end of loop?