By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,326 Members | 2,726 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,326 IT Pros & Developers. It's quick & easy.

vb.NET Missing a 'continue' statement in while loop?

P: n/a
Is this language missing the functionality of a C/C++ 'continue' statement?

For example:

While NOT isEof()
If condition
' a C or C++ continue would work here
' but we are forced to use a GoTo
GoTo nxt
End If
... more statements here ...
nxt:
End While

You CAN rewrite the code to get rid of the GoTo by adding an 'else' to
the If, but code complexity increases as you're nesting more code in
conditionals.

Nov 20 '05 #1
Share this Question
Share on Google+
15 Replies


P: n/a

"PagCal" <pa****@runbox.com> wrote in message
news:uN***************@tk2msftngp13.phx.gbl...
Is this language missing the functionality of a C/C++ 'continue'

statement?

Yes. We will get this with VB 2005. FINALLY!
Nov 20 '05 #2

P: n/a
* PagCal <pa****@runbox.com> scripsit:
Is this language missing the functionality of a C/C++ 'continue' statement?


Up to version 2003, yes. In 2005, we will have 'Continue' and 'Continue
<type of loop>' too.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

P: n/a

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2l************@uni-berlin.de...
Is this language missing the functionality of a C/C++ 'continue'
statement?
Up to version 2003, yes. In 2005, we will have 'Continue' and 'Continue
<type of loop>' too.


Really? I hadn't noticed that. So if you're in a For...Next loop nested
inside a Do While loop you can use Continue Do to completely exit the For
and iterate the Do?
Nov 20 '05 #4

P: n/a
It appears so... which gives us the 'edge'

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2l************@uni-berlin.de...
Is this language missing the functionality of a C/C++ 'continue'

statement?

Up to version 2003, yes. In 2005, we will have 'Continue' and 'Continue
<type of loop>' too.


Really? I hadn't noticed that. So if you're in a For...Next loop nested
inside a Do While loop you can use Continue Do to completely exit the For
and iterate the Do?

Nov 20 '05 #5

P: n/a
Jeff,

* "Jeff Johnson [MVP: VB]" <i.***@enough.spam> scripsit:
Is this language missing the functionality of a C/C++ 'continue'
statement?


Up to version 2003, yes. In 2005, we will have 'Continue' and 'Continue
<type of loop>' too.


Really? I hadn't noticed that. So if you're in a For...Next loop nested
inside a Do While loop you can use Continue Do to completely exit the For
and iterate the Do?


Yes :-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6

P: n/a
Having managed to completely avoid C and C++ (and C#) for nearly 11 years of
programming now.... can someone explain a bit more about the Continue
statement?? From this thread I just gathered it did the same as Exit
For??!!
____________________________
The Grim Reaper

"Tom Spink" <thomasdotspinkatsp@mntlworlddotcom> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
It appears so... which gives us the 'edge'

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2l************@uni-berlin.de...
> Is this language missing the functionality of a C/C++ 'continue'

statement?

Up to version 2003, yes. In 2005, we will have 'Continue' and 'Continue <type of loop>' too.


Really? I hadn't noticed that. So if you're in a For...Next loop nested
inside a Do While loop you can use Continue Do to completely exit the For and iterate the Do?


Nov 20 '05 #7

P: n/a
Ever read Reaper Man? Fantastic story....

The Continue statement does not exit the for loop, it moves directly to the
next statement:

For I As Integer = 1 To 10
If I < 5 Then Continue For
MsgBox(I.ToString())
Next I

While the value of I is less than 5, the execution will jump to 'Next I'
bypassing all after it. When I is greater than or equal to 5, Continue For
will not be called, so execution will occurr as normal.

This also applies to a For Each statement:

For Each strString As String In SomeStringArray
If strString = "SomeValue" Then Continue For
MsgBox(strString)
Next
--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"The Grim Reaper" <gr*********@btopenworld.com> wrote in message
news:cc**********@hercules.btinternet.com...
Having managed to completely avoid C and C++ (and C#) for nearly 11 years of programming now.... can someone explain a bit more about the Continue
statement?? From this thread I just gathered it did the same as Exit
For??!!
____________________________
The Grim Reaper

"Tom Spink" <thomasdotspinkatsp@mntlworlddotcom> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
It appears so... which gives us the 'edge'

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2l************@uni-berlin.de...

> > Is this language missing the functionality of a C/C++ 'continue'
statement?
>
> Up to version 2003, yes. In 2005, we will have 'Continue' and 'Continue > <type of loop>' too.

Really? I hadn't noticed that. So if you're in a For...Next loop nested inside a Do While loop you can use Continue Do to completely exit the For and iterate the Do?



Nov 20 '05 #8

P: n/a
Hi Grim, have you ever used the Cobol Alter statement, for me it is
something like that.

I read that we can be glad to get that kind of behaviour back.

:-(

Cor
Nov 20 '05 #9

P: n/a
Noooooooooooooooooooooooooooooooooooooo

Not the dreaded ALTER GOTO

Had to use that once to save 8 bytes of core memory :)
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi Grim, have you ever used the Cobol Alter statement, for me it is
something like that.

I read that we can be glad to get that kind of behaviour back.

:-(

Cor

Nov 20 '05 #10

P: n/a
* "Tom Spink" <thomasdotspinkatsp@mntlworlddotcom> scripsit:
The Continue statement does not exit the for loop, it moves directly to the
next statement:

For I As Integer = 1 To 10
If I < 5 Then Continue For
MsgBox(I.ToString())
Next I


ACK. As mentioned before, you can jump to the next outer loop too:

\\\
Do While...
For...To...
If...Then Continue Do
Next...
Loop
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #11

P: n/a
On Sat, 10 Jul 2004 00:09:44 +1200, Stephany Young wrote:
Noooooooooooooooooooooooooooooooooooooo

Not the dreaded ALTER GOTO

Had to use that once to save 8 bytes of core memory :)
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi Grim, have you ever used the Cobol Alter statement, for me it is
something like that.


I remember learning COBOL in college, but I have never looked at it since.
(Thank Goodness!)

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 20 '05 #12

P: n/a
I remember learning Prolog in College :: shudder ::

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in
message news:15*****************************@40tude.net...
On Sat, 10 Jul 2004 00:09:44 +1200, Stephany Young wrote:
Noooooooooooooooooooooooooooooooooooooo

Not the dreaded ALTER GOTO

Had to use that once to save 8 bytes of core memory :)
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi Grim, have you ever used the Cobol Alter statement, for me it is
something like that.


I remember learning COBOL in college, but I have never looked at it since.
(Thank Goodness!)

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

Nov 20 '05 #13

P: n/a
Ahhh..... gotcha!! Sounds very useful.

I prefer Mort and Pyramids personally - but then I think they're all
fantastic :D
_______________________________
The Grimy Reaper

"Tom Spink" <thomasdotspinkatsp@mntlworlddotcom> wrote in message
news:OH**************@TK2MSFTNGP12.phx.gbl...
Ever read Reaper Man? Fantastic story....

The Continue statement does not exit the for loop, it moves directly to the next statement:

For I As Integer = 1 To 10
If I < 5 Then Continue For
MsgBox(I.ToString())
Next I

While the value of I is less than 5, the execution will jump to 'Next I'
bypassing all after it. When I is greater than or equal to 5, Continue For
will not be called, so execution will occurr as normal.

This also applies to a For Each statement:

For Each strString As String In SomeStringArray
If strString = "SomeValue" Then Continue For
MsgBox(strString)
Next
--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"The Grim Reaper" <gr*********@btopenworld.com> wrote in message
news:cc**********@hercules.btinternet.com...
Having managed to completely avoid C and C++ (and C#) for nearly 11 years
of
programming now.... can someone explain a bit more about the Continue
statement?? From this thread I just gathered it did the same as Exit
For??!!
____________________________
The Grim Reaper

"Tom Spink" <thomasdotspinkatsp@mntlworlddotcom> wrote in message
news:OV**************@TK2MSFTNGP12.phx.gbl...
It appears so... which gives us the 'edge'

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...
>
> "Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message > news:2l************@uni-berlin.de...
>
> > > Is this language missing the functionality of a C/C++ 'continue'
> statement?
> >
> > Up to version 2003, yes. In 2005, we will have 'Continue' and

'Continue
> > <type of loop>' too.
>
> Really? I hadn't noticed that. So if you're in a For...Next loop nested > inside a Do While loop you can use Continue Do to completely exit

the For
> and iterate the Do?
>
>



Nov 20 '05 #14

P: n/a
My history.... (hold your breath....)

Commodore 64 Basic (can't even remember what it was called!!)
BBC Basic (again.. vague recollection...)
QBasic
AmigaBasic
BlitzBasic
Back to QBasic
VB6
VB.NET

I'm somehow managed to completely avoid C, C++ and C#, while learning god
knows how many ladder logic languages, Spanish and the Speak Of Woman.
Although still not fluent in that one.
_______________________________
The Grim Reaper

"Tom Spink" <thomasdotspinkatsp@mntlworlddotcom> wrote in message
news:uC*************@TK2MSFTNGP11.phx.gbl...
I remember learning Prolog in College :: shudder ::

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in
message news:15*****************************@40tude.net...
On Sat, 10 Jul 2004 00:09:44 +1200, Stephany Young wrote:
Noooooooooooooooooooooooooooooooooooooo

Not the dreaded ALTER GOTO

Had to use that once to save 8 bytes of core memory :)
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
> Hi Grim, have you ever used the Cobol Alter statement, for me it is
> something like that.
>


I remember learning COBOL in college, but I have never looked at it since. (Thank Goodness!)

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.


Nov 20 '05 #15

P: n/a
lol. My history is very similar.
Only replace BlitzBasic with Assembly, ANSI C, then insert VB3, 4, and 5
(although not sure it officially made it out of Beta).
VIC 20 Basic
PET Basic / CPM
Commodore 64/128 Basic
QBasic
AmigaBasic
Assembly
ANSI C
Fortran
MDL (MicroStation Development Language "C" like)
VB3, VB4, VB5, VB6 (Although I think VB5 barely made it out of Beta)
MBE MicroStation Basic
VB.Net + C# only when VB won't do something I need.

Somehow I have managed to get by without ever having to learn C++, or Java.

Gerald

"The Grim Reaper" <gr*********@btopenworld.com> wrote in message
news:cc**********@titan.btinternet.com...
My history.... (hold your breath....)

Commodore 64 Basic (can't even remember what it was called!!)
BBC Basic (again.. vague recollection...)
QBasic
AmigaBasic
BlitzBasic
Back to QBasic
VB6
VB.NET

I'm somehow managed to completely avoid C, C++ and C#, while learning god
knows how many ladder logic languages, Spanish and the Speak Of Woman.
Although still not fluent in that one.
_______________________________
The Grim Reaper

"Tom Spink" <thomasdotspinkatsp@mntlworlddotcom> wrote in message
news:uC*************@TK2MSFTNGP11.phx.gbl...
I remember learning Prolog in College :: shudder ::

--
HTH,
-- Tom Spink, Über Geek

Woe be the day VBC.EXE says, "OrElse what?"

Please respond to the newsgroup,
so all can benefit
"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcglobal[dot]]net"> wrote in
message news:15*****************************@40tude.net...
On Sat, 10 Jul 2004 00:09:44 +1200, Stephany Young wrote:

> Noooooooooooooooooooooooooooooooooooooo
>
> Not the dreaded ALTER GOTO
>
> Had to use that once to save 8 bytes of core memory :)
>
>
> "Cor Ligthert" <no**********@planet.nl> wrote in message
> news:%2***************@TK2MSFTNGP11.phx.gbl...
>> Hi Grim, have you ever used the Cobol Alter statement, for me it is
>> something like that.
>>

I remember learning COBOL in college, but I have never looked at it since. (Thank Goodness!)

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.



Nov 20 '05 #16

This discussion thread is closed

Replies have been disabled for this discussion.