Can a continue be used in an if in c? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can a continue be used in an if in c?

To create a loop using if

3rd Apr 2021, 2:31 AM
Gunasekaran Ayyasamy
Gunasekaran Ayyasamy - avatar
2 Answers
+ 2
"continue" has nothing to do with the if statement but if the statement is in a loop then you can write "continue" or "break" like this: for(;I<n;i++) { if (I % 2 == 0) continue; }
3rd Apr 2021, 2:44 AM
Rejwan Islam
Rejwan Islam - avatar
0
Yes it is possible for ( int num = 1; num <= 10; num++ ) { if ( num == 5 ) continue; printf( "%d ", num ); }
3rd Apr 2021, 2:45 AM
Ipang