End Statement

結束程序或陳述區塊。

語法

End, End Function, End If, End Select, End Sub

參數:

按如下所示使用 End 陳述式:

陳述式

End:不是必要陳述,但可以在程序的任意位置輸入此陳述來結束程式的執行。

End Function:結束 Function 陳述式。

End If:標記 If...Then...Else 陳述區塊的結束。

End Select:標記 Select Case 陳述區塊的結束。

End Sub:結束 Sub 陳述式。

示例:

Sub ExampleRandomSelect

Dim iVar As Integer

    iVar = Int((15 * Rnd) -2)

    Select Case iVar

        Case 1 To 5

            Print "Number from 1 to 5"

        Case 6, 7, 8

            Print "Number from 6 to 8"

        Case Is > 8 And iVar < 11

            Print "Greater than 8"

        Case Else

            Print "Outside range 1 to 10"

    End Select

End Sub