VBScript 流程

IF 语句

IF x>1 THEN x=x*2 [ELSE x=x/2]
IF x>1 then

    x = x*2

[ELSE

    x = x/2]

END IF

SELECT CASE 语句

SELECT CASE testvalue

CASE value1

    statement1

CASE value2 TO value3

    Statement2

CASE IS oper value4  ' IS > 0

    Statement3

CASE ELSE

    Statement

END SELECT

FOR 语句

FOR var = value1 TO value2

    Statement

    [EXIT FOR] '提前退出循环

NEXT [var]

FOR EACH var IN array

    Statement

NEXT

DO 循环语句

DO WHILE condition

    Statement

    [EXIT DO]

LOOP

DO

    Statement

    [EXIT DO]

LOOP WHILE condition

DO UNTIL condition

    Statement

    [EXIT DO]

LOOP

DO

    Statement

    [EXIT DO]

LOOP UNTIL condition

WHILE '早期遗留,不建议使用

   Statement

WEND

ON ERROR 语句

ON ERROR GOTO label ' 遇错时转到某位置

label:

RESUME label2 '从错误处理中返回

ON ERROR RESUME NEXT ' 遇错时跳过
ON ERROR GOTO 0 ' 取消错误处理