Re: How to do "continue" in VB?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Jim Carlock (anonymous_at_localhost.com)
Date: 02/06/05


Date: Sun, 6 Feb 2005 16:10:45 -0500

The continue statement in C is used to exit a for, while or do
loop in C.

To do the same thing in VB...

For i = 1 to 1000
  'do main stuff inside of loop
  'check window status...
  '...
  If (hWnd = 0) Then Exit For
  If key = vbKeyEscape Then Exit For
  DoEvents
Next i

It seems as if most folks indicate to use "continue" sparingly...
in the C programming language, and to only use it in top level
loops.

Wonder what's up with Apple?
http://www.opensource.apple.com/darwinsource/WWDC2004/bsdmake-11/for.c

HTH.

--
Jim Carlock
Post replies to newsgroup.
"lonnyw" <<> wrote in message news:eHNxNsIDFHA.1260@TK2MSFTNGP12.phx.gbl...
I am changing a program from C to VB. It is quite easy,
but I have not found a good way to do a "continue" from
C's for loop
e.g
if( hWnd==0 ) continue;
tia. 


Relevant Pages

  • Re: Infinite Loops and Explicit Exits
    ... > CS> One of these proposals relaxes the current restriction that an EXIT ... > termination of the loop is not visible at that point. ... > terminating condition is visible in that context. ... > You now want to allow this remote procedure, ...
    (comp.lang.cobol)
  • Re: Houston-related rants was Re: forced merges/inside lane merges/AASHTO "tapered merges"
    ... >> Are you sure about the North Loop and I-45? ... >> in particular the westbound exit for Fondren/Gessner. ... How could HCTRA put an exit ramp for eastbound ... and the West Houston Center Blvd exit still shows Old Westheimer ...
    (misc.transport.road)
  • Re: Exit Do
    ... I've been instructed by a dot net / asp programmer that Exit Do is ... I am using nested loops and need to exit out of one loop into ... If Some Reason to stop loop then Exit Do ... Code Stage B ...
    (microsoft.public.scripting.vbscript)
  • Re: Exit Do
    ... I've been instructed by a dot net / asp programmer that Exit Do is ... I am using nested loops and need to exit out of one loop into ... Code Stage B ... likely to lead to bugs and readability problems. ...
    (microsoft.public.scripting.vbscript)
  • Re: Infinite Loops and Explicit Exits
    ... CS> There are cases in which EXIT PERFORM is, I think, clearer than GO TO ... procedure-name-1 SECTION. ... repetition in the main loop statement is being overrun by some minor ... particularly when the requirements of elegance ...
    (comp.lang.cobol)