for 循環
用法
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 #中止當前循環繼續循環