Exit if

lothos12345

Junior Contributor
Joined
May 2, 2002
Messages
294
Location
Texas
Is there a way to exit and if statement for example

Do while <variable> <> <criteria>
If <variable> = true then
<problem here>
Else
Perform program operations here!
End if
Loop

I want to exit the if statement without exiting the Do While Loop. Is there a way I can do this?

Any help with this is greatly apprieciated.
 
Code:
Do while <variable> <> <criteria>
       If <variable> = true then
          <problem here>
       Else
          Perform program operations here!
       End if
Loop

I am wondering why do you need to exit if??
Just leave the condition, then it will do nothing,

Code:
If variable <> criteria
       'do nothing, in other word, already exit
else
       'do something
end if
 
If you're just going to have series of If...ElseIf statements, then maybe a Select Case
statement might fit the situation better. Only one Case is ever executed, and the
Select statement is "exited" after the first true case is found.
 
If you really want this the try block can accomplish it.
Not very elegant but it would do what you want

If Nbr > 1 then
Try
Do some statements

If Nbr > 10 then
Exit Try
End If

Do some more statements

Catch
End Try
End If
 
Back
Top