Re: how do people feel about exit function from loop
- From: "Michael C" <nospam@xxxxxxxxxx>
- Date: Wed, 25 Jul 2007 11:36:15 +1000
"Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:uDBiXAlzHHA.312@xxxxxxxxxxxxxxxxxxxxxxx
But the same logic applies...if you're concerned about having one way out
of a function, it follows that you will likely be the type who also likes
one way out of a loop (for most of the same reasons), thus wanting to
avoid Exit.
Not really. The logic behind having one way out of a function is that you
can have cleanup code to release references etc (which has mostly been
eliminated with high level languages). For a loop there is no chance to have
cleanup code except after it, so the cleanup code will be called anyway. The
one-way-out is by going to the line of code after the loop.
In a language with try/catch/finally block this is all moot anyway because
you can have your exit function and have one way out, eg
Private Sub ABC()
dim rs as new recordset
rs.open "Blah"
Try
While not rs.eof
if rs!Something = SomethingElse then exit sub
rs.movenext
Wend
finally
rs.close
End Try
Michael
.
- Follow-Ups:
- Re: how do people feel about exit function from loop
- From: Robert Morley
- Re: how do people feel about exit function from loop
- References:
- how do people feel about exit function from loop
- From: greg
- Re: how do people feel about exit function from loop
- From: Ken Halter
- Re: how do people feel about exit function from loop
- From: Jan Hyde (VB MVP)
- Re: how do people feel about exit function from loop
- From: Steve Gerrard
- Re: how do people feel about exit function from loop
- From: Michael C
- Re: how do people feel about exit function from loop
- From: Robert Morley
- how do people feel about exit function from loop
- Prev by Date: Re: how do people feel about exit function from loop
- Next by Date: Re: how do people feel about exit function from loop
- Previous by thread: Re: how do people feel about exit function from loop
- Next by thread: Re: how do people feel about exit function from loop
- Index(es):
Relevant Pages
|