for and while loop in c#

前端 未结 6 1815
长情又很酷
长情又很酷 2020-12-03 05:22
for (i=0 ; i<=10; i++)
{
    ..
    ..
}

i=0;
while(i<=10)
{
    ..
    ..
    i++;
}

In for and while loop, which one is better, performanc

6条回答
  •  醉酒成梦
    2020-12-03 05:42

    Neither one. They are equivalent. You can think of the 'for' loop being a more compact way of writing the while-loop.

提交回复
热议问题