語法:For counter = start To end [ Step step ] … next --中途退出:exit for -- step缺省值為1 實例: For cnt = 1 to 9 step 1 Debug.print cnt If cnt = 8 then : exit for next
語法 For Each element In group Statements [Exit for] Statements Next [element]
-- while 當滿足條件時循環(huán) -- until 當滿足條件時停止循環(huán) 語法1: Do {while |until} condition
Statements
[Exit do]
Statements
Loop--先檢測是否滿足循環(huán)條件,滿足循環(huán)條件則執(zhí)行代碼塊 語法2: Do
Statements
[Exit do]
Statements
Loop {while |until} condition--不管滿不滿足循環(huán)條件,先執(zhí)行一遍代碼塊,再檢測是否滿足循環(huán)條件,滿足循環(huán)條件則繼續(xù)執(zhí)行代碼塊
滿足條件時循環(huán),VB老語法,不推薦用
|
|
|