Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

How to exit an iteration (for loop)

$
0
0
Hey guys,
I want to know if there is any keyword that can be used to exit an iteration, but not the entire loop.. for example if i want to print the numbers from 1 to 10, but exclude 6:

for(int i=1; i<=10; i++){
   if(i == 6)
      //what keyword could be used here to go to the next iteration?

   cout<< i << ", ";




thanks!

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>