Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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,

 

If variable <> criteria
      'do nothing, in other word, already exit
else
      'do something
end if

George C.K. Low

  • *Experts*
Posted

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.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

  • 8 years later...
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...