while&&do while&&for

1.初始化变量。

2.while判定如果为ture则继续执行循环(循环体,累加器),若判定为false,则终止循环。

while&&do while&&for

do while 与while的区别:

do while不管是否满足条件都先执行一次循环体(先执行后判断)。while先判断后执行。

while&&do while&&for

for循环与while循环的使用时机:

for用于循环次数固定的场合。

while用于循环次数不固定的场合。

相关文章:

  • 2022-12-23
  • 2022-01-05
  • 2021-07-25
  • 2021-11-27
  • 2021-04-26
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
猜你喜欢
  • 2022-02-20
  • 2021-10-18
  • 2021-07-24
  • 2021-10-10
  • 2022-02-27
  • 2022-03-02
相关资源
相似解决方案