< Day Day Up > |
There are two statements that can control the overall program flow. The End statement causes program execution to end. This statement may not be used in class libraries (i.e., DLLs), because they are not executable. For example: Module Test Sub Main() Dim x As Integer While True x = CInt(Console.ReadLine()) If x = 0 Then End End If End While End Sub End Module
The Stop statement also causes program execution to end, but will also transfer control to a debugger if one is present. Stop is primarily useful when you are developing a program that needs to run for some time before debugging begins. For example: Module Test Sub Main() Dim x As Integer While x > 0 x = CInt(Console.ReadLine()) ' When x = -1, break into the debugger. If x = -1 Then Stop End If End While End Sub End Module
|
< Day Day Up > |