473,763 Members | 2,930 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I miss loop

cj
When I'm inside a do while loop sometimes it's necessary to jump out of
the loop using exit do. I'm also used to being able to jump back and
begin the loop again. Not sure which language my memories are of but I
think I just said loop somewhere inside the loop and it immediately
jumped back to the start of the loop and began again. I can't seem to
do that in .net. I this functionality available?
Mar 14 '06 #1
32 2602

"cj" <cj@nospam.nosp am> wrote in message
news:ex******** ******@tk2msftn gp13.phx.gbl...
When I'm inside a do while loop sometimes it's necessary to jump out of
the loop using exit do. I'm also used to being able to jump back and
begin the loop again. Not sure which language my memories are of but I
think I just said loop somewhere inside the loop and it immediately jumped
back to the start of the loop and began again. I can't seem to do that in
.net. I this functionality available?


I think in VB.Net 2005, you have the Continue statement, but I'm not sure.
In C#, it's continue (if my memory serves correctly).

HTH,
Mythran

Mar 14 '06 #2
cj
Unfortunately I'm using VB.Net 2003 right now and continue doesn't
appear to do that in 2003. I believe continue does have that
functionality in some language.

Mythran wrote:

"cj" <cj@nospam.nosp am> wrote in message
news:ex******** ******@tk2msftn gp13.phx.gbl...
When I'm inside a do while loop sometimes it's necessary to jump out
of the loop using exit do. I'm also used to being able to jump back
and begin the loop again. Not sure which language my memories are of
but I think I just said loop somewhere inside the loop and it
immediately jumped back to the start of the loop and began again. I
can't seem to do that in .net. I this functionality available?


I think in VB.Net 2005, you have the Continue statement, but I'm not
sure. In C#, it's continue (if my memory serves correctly).

HTH,
Mythran

Mar 14 '06 #3
"cj" <cj@nospam.nosp am> schrieb:
Unfortunately I'm using VB.Net 2003 right now and continue doesn't appear
to do that in 2003. I believe continue does have that functionality in
some language.


You can still mimick the behavior of 'continue' using a named label and
'GoTo'...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 14 '06 #4
cj
Whowa! Your sure to get blasted for that idea. I hope you aren't using
your real name. :) I just might do that though.
Herfried K. Wagner [MVP] wrote:
"cj" <cj@nospam.nosp am> schrieb:
Unfortunately I'm using VB.Net 2003 right now and continue doesn't
appear to do that in 2003. I believe continue does have that
functionality in some language.


You can still mimick the behavior of 'continue' using a named label and
'GoTo'...

Mar 14 '06 #5
cj wrote:
When I'm inside a do while loop sometimes it's necessary to jump out
of the loop using exit do. I'm also used to being able to jump back
and begin the loop again. Not sure which language my memories are of
but I think I just said loop somewhere inside the loop and it
immediately jumped back to the start of the loop and began again. I
can't seem to do that in .net. I this functionality available?


The meaning of "continue" is to start the *next* iteration immediately and
bypass any further code in the loop body. If you want to continue the
current operation then you'd either have an inner loop or use a goto. If you
want to completely restart the loop then you'd be best enclosing it in an
outer loop. You mustn't use the goto idea for that one. Jumping out of the
loop to before the loop - that should get you those frowns. ;o)

Mar 14 '06 #6
cj
I understand the functionality of continue. I also understand it
doesn't work in VB.Net 2003, right? It does in 2005, right?

I understand why goto is not generally a good thing but just because a
command has been frequently misused in the past doesn't make it bad. I
admire Herfried for suggesting goto. It seems like a perfect use.
Still I'm having a hard time using it because other say it's wrong.
It's a real conundrum. There has to be a way that socially acceptable
and personally feels right.

An outer loop is what I have started with because goto has been out of
my vocabulary since 87. Still I just don't like seeing one loop
inserted inside another just for this functionality. It looks funny and
just seems wrong. I'll come up with a better way. Something in the
nature subroutines and flags etc. I'll get something that feels better
when I get back to work tomorrow.
dotNuttah wrote:
cj wrote:
When I'm inside a do while loop sometimes it's necessary to jump out
of the loop using exit do. I'm also used to being able to jump back
and begin the loop again. Not sure which language my memories are of
but I think I just said loop somewhere inside the loop and it
immediately jumped back to the start of the loop and began again. I
can't seem to do that in .net. I this functionality available?


The meaning of "continue" is to start the *next* iteration immediately and
bypass any further code in the loop body. If you want to continue the
current operation then you'd either have an inner loop or use a goto. If you
want to completely restart the loop then you'd be best enclosing it in an
outer loop. You mustn't use the goto idea for that one. Jumping out of the
loop to before the loop - that should get you those frowns. ;o)

Mar 15 '06 #7
VB 6 doesn't have it either. What you see in VB 6 program is:

do
if somecondition then
...
...
end if
loop

In VB 2005 this would be

do
if not somecondition then continue
...
...
loop

It's awkward but it works. Also, it's interesting to note that the VB 2005
continue doesn't actually jump back to the start of the loop. It actually
jumps to the end of the loop and lets the loop control jump back. Watch it
in the debugger.

Mike Ober.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"cj" <cj@nospam.nosp am> schrieb:
Unfortunately I'm using VB.Net 2003 right now and continue doesn't appear to do that in 2003. I believe continue does have that functionality in
some language.


You can still mimick the behavior of 'continue' using a named label and
'GoTo'...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Mar 15 '06 #8
cj,

I don't agree with you and there is in my opinion enough written in this
newsgroup about that.

Can't you not use a Select Case. Probably makes that your program again much
readable then.

Cor

"cj" <cj@nospam.nosp am> schreef in bericht
news:ei******** ******@TK2MSFTN GP11.phx.gbl...
I understand the functionality of continue. I also understand it doesn't
work in VB.Net 2003, right? It does in 2005, right?

I understand why goto is not generally a good thing but just because a
command has been frequently misused in the past doesn't make it bad. I
admire Herfried for suggesting goto. It seems like a perfect use. Still
I'm having a hard time using it because other say it's wrong. It's a real
conundrum. There has to be a way that socially acceptable and personally
feels right.

An outer loop is what I have started with because goto has been out of my
vocabulary since 87. Still I just don't like seeing one loop inserted
inside another just for this functionality. It looks funny and just seems
wrong. I'll come up with a better way. Something in the nature
subroutines and flags etc. I'll get something that feels better when I
get back to work tomorrow.
dotNuttah wrote:
cj wrote:
When I'm inside a do while loop sometimes it's necessary to jump out
of the loop using exit do. I'm also used to being able to jump back
and begin the loop again. Not sure which language my memories are of
but I think I just said loop somewhere inside the loop and it
immediately jumped back to the start of the loop and began again. I
can't seem to do that in .net. I this functionality available?


The meaning of "continue" is to start the *next* iteration immediately
and
bypass any further code in the loop body. If you want to continue the
current operation then you'd either have an inner loop or use a goto. If
you
want to completely restart the loop then you'd be best enclosing it in an
outer loop. You mustn't use the goto idea for that one. Jumping out of
the
loop to before the loop - that should get you those frowns. ;o)


Mar 15 '06 #9
cj wrote:
When I'm inside a do while loop sometimes it's necessary to jump out of
the loop using exit do. I'm also used to being able to jump back and
begin the loop again. Not sure which language my memories are of but I
think I just said loop somewhere inside the loop and it immediately
jumped back to the start of the loop and began again. I can't seem to
do that in .net. I this functionality available?


Did you use Clipper(xBase) by any chance? There a loop contruction there
like you describe it. I'm missing it too in VB. When porting some
routines over from xBase++ I've run into this problem and had to rethink
the logic.. too bad :(
--
Rinze van Huizen
C-Services Holland b.v
Mar 15 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2246
by: F. GEIGER | last post by:
When I start a py2exe-ed application I get the error 'ascii' codec can't encode character u'\xe9' in position 10: ordinal not in range(128) This is how I run py2exe: setup.py py2exe -O1 --packages encodings This is how the .po-file looks like:
2
1285
by: John Bailo | last post by:
Doing some c# client programming in VS.net One thing I miss is that in the code view I could set the focus to a form object in the left hand drop down ( like a TreeView control ) and then the right hand drop down would expose only the properties and events associated with that control. I don't see that in VS.NET
8
1405
by: ibm_97 | last post by:
DB2 8.2 I try to add a column into a table. I think the procedure inside DB2 is: 1. Create a temporary table which has the old table stucture and data. 2. Drop the original table 3. Create the new table with the added column 4. Insert data back into the new table from that temporary table.
7
1893
by: [Yosi] | last post by:
Hi, I create a thread which load DLL and have DLL function call,this Dll function takes a lot of time. My Question is , if I request Thread.Susspend(), and the thread is inside the Dll function (Dll function not finished yet, and thread function wait for this function (DLL)call to compleate), what will happen ? is this will susspend also the Dll function execution ? or will delay the susspend untill this function returned ? Thx
1
1531
by: kmounkhaty | last post by:
Hi Guru, My profiler trace does not display SP:CACHEMISS event, even thought I drop store proc, clear both data cache and buffer cache but still does not work. Every thing works fine like: cachehit, cacheinsert,cacheremove,executecontexthit etc... Is there any special option that I need to turn it on?
28
1723
by: Useful Info | last post by:
Like on 9/11, the Federal Government apparently WANTED people to die at the hands of Cho at VA Tech, because they told campus police not to pursue Cho after the double homicide occurred. Story via http://Muvy.org
8
12911
by: anukedari | last post by:
Hi, Could any boby please help to get the answers for the following questions: Is Apache always sends "X-Cache:MISS" header even when caching is off (disable)? or Can we say that cache settings are enable if it sends "X-Cache:MISS" header in the response? Your help would be appreciated.
0
1399
by: manikandan | last post by:
dont miss it just open dont miss it just open dont miss it just open #############################
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9819
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7364
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5268
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3916
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2790
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.