Why is break statement executed but continue statement is not?
vector<int>val {2,3,4,-1,5,6,-1,56,234,-99,26,35,12,3,4};
for (auto name: val) {
cout << name << endl;
if (name == -1)
continue;
else if (name == -99)
break;
}
Why does it not skip -1 (not execute continue statement) as indicated above in the code but at the same time it execute the break function. It displays following numbers to the console:
2
3
4
-1
5
6
-1
56
234
-99