📅  最后修改于: 2020-10-19 04:06:49             🧑  作者: Mango
在某些情况下,您需要多次执行一个代码块。通常,语句是按顺序执行的:函数的第一个语句首先执行,然后第二个执行,依此类推。
编程语言提供了各种控制结构,允许更复杂的执行路径。循环语句使我们可以多次执行一个语句或一组语句,以下是VBScript中循环语句的常规内容。
VBScript提供以下类型的循环来处理循环需求。单击以下链接检查其详细信息。
Loop Type | Description |
---|---|
for loop | Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. |
for ..each loop | It is executed if there is at least one element in group and reiterated for each element in a group. |
while..wend loop | It tests the condition before executing the loop body. |
do..while loops | The do..While statements will be executed as long as condition is True.(i.e.,) The Loop should be repeated till the condition is False. |
do..until loops | The do..Until statements will be executed as long as condition is False.(i.e.,) The Loop should be repeated till the condition is True. |
循环控制语句从其正常顺序更改执行。当执行离开作用域时,将不执行循环中的所有其余语句。
VBScript支持以下控制语句。单击以下链接以查看其详细信息。
Control Statement | Description |
---|---|
Exit For statement | Terminates the For loop statement and transfers execution to the statement immediately following the loop |
Exit Do statement | Terminates the Do While statement and transfers execution to the statement immediately following the loop |