continue;//中断本次循环,之后代码不执行,继续执行下次循环

break;//终止while循环

using System;

namespace Demo
{
    class Program
    {
        public static void Main(string[] args)
        {
//输出1~9,5除外
            int index=0;
            while(true){
                index++;
                if(index==5){
                    continue;//中断本次循环,之后代码不执行,继续执行下次循环
                }
                if(index==10){
                    break;//终止while循环
                }
                Console.WriteLine(index);
            }
            Console.ReadKey();
        
    }
}
}

 

相关文章:

  • 2022-12-23
  • 2021-06-28
  • 2022-02-16
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-24
  • 2021-12-02
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
相关资源
相似解决方案