用法

for (n in m) expr 

若n在m中则运行 expr

while 循环

用法

while (condition) expr

当符合condition时运行expr

repeat 循环

用法

repeat expr

持续运行expr。通常配合break中止语句使用,不然将陷入无限循环。

if/else 判断

用法

if (condition1)
    expr1
else if (condition2)
    expr2
else 
    expr3 

当符合condition1时运行expr1,不符合1但符合2时运行expr2,都不符合时运行expr3。

中止语句

用法

break #中止循环退出循环
next #中止当前循环继续循环

相关文章:

  • 2022-12-23
  • 2021-12-22
  • 2021-11-28
  • 2022-12-23
  • 2021-12-01
  • 2022-01-16
  • 2022-12-23
  • 2021-05-27
猜你喜欢
  • 2022-12-23
  • 2022-01-21
  • 2021-07-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
相关资源
相似解决方案