发布时间:2019-09-02 07:39:22编辑:auto阅读(1824)
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性能超高的研
49392
48595
39282
36372
30778
27593
26585
21405
21268
19614
256°
494°
483°
576°
938°
647°
1328°
1580°
1251°
1231°