发布时间:2019-09-02 07:39:22编辑:auto阅读(1695)
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 % 2) == 0) break; Console.WriteLine("{0}",i++); } while(i<=10); //break, 立即终止循环;执行后面语句 Console.WriteLine("Output do{.. continue;} while() result"); int j= 1; do { if ((j++ % 2) == 0) Console.WriteLine("{0}", j); continue; } while (j <= 10); //continue, 终止当前循环;执行下一个循环; Console.WriteLine("Output do{.. break;} while(true) result"); int k = 1; do { if ((k++ % 2) == 0) Console.WriteLine("{0}", k); break; } while (true); //死循环,用break跳出循环; Console.WriteLine("Output do{.. continue;} while(true) result"); int z= 1; do { if ((z % 2) == 0) continue; Console.WriteLine("{0}", z++); } while (true); //死循环,continue,关闭程序跳出循环; Console.ReadLine(); } } }
上一篇: ×××-gre隧道H3C篇
下一篇: 关于东芝BG3 PCMARK性能超高的研
47868
46434
37321
34767
29337
25999
24952
19970
19568
18056
5811°
6436°
5953°
5979°
7083°
5929°
5970°
6462°
6427°
7804°