3. C # break,continue, dead Loop

Source: Internet
Author: User

Using system;using system.collections.generic;using system.linq;using system.text;using  system.threading.tasks;namespace consoleapplication1{    class program{         static void main (String[] args) {             console.writeline ("Output do{.  break;}  while ()  result ");             int i  = 1;            do {                 if  ((I&NBSP;%&NBSP;2)  == 0)                      break;                 consOle. WriteLine ("{0}", i++);}             while (i<=10);             //break,  immediately terminates the loop, executes the following statement              console.writeline ("output do{.  continue;}  while ()  result ");             int j = 1;            do{                 if  ((j++ % 2)  ==  0)                                       console.writeline ("{0}",  j);              &Nbsp;  continue;}             while  (J&NBSP;&LT;=&NBSP;10);             //continue,  terminates the current loop; executes the next loop;              console.writeline ("Output do{.  break;}  while (True)  result ");             int  k = 1;            do{                 if  (k++ %  2)  == 0)                      console.writeline ("{0}",  k);                 break;}             while  (True);             //dead Loop, break out of the loop with break;             Console.WriteLine ("Output do{.  continue;}  while (True)  result ");             int   z= 1;            do{                 if  ((Z&NBSP;%&NBSP;2)  == 0)                      continue;                     console.writeline ("{0}",  z++);}             while  (true); &NBSP;&NBSP;&NBSP;&Nbsp;        //dead Loop, continue, close program out of Loop;             console.readline ();}}}

This article comes from the "Ricky's blog" blog, please be sure to keep this source http://57388.blog.51cto.com/47388/1650516

3. C # break,continue, dead Loop

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.