C# while循环

while循环相当于for循环的另一个版本。

int sum = 0;
int a = 1;

while(a<=10)
{
  sum++;

  a++;
}

while循环结构:

 初始条件

while(判断条件)

{

  循环体;

  状态改变;

}

while循环不常用,一般可以这么用

while(true)

{

  

}

死循环。

原文地址:https://www.cnblogs.com/shenyuyaqing/p/7089718.html