Re: how do people feel about exit function from loop
- From: "Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 25 Jul 2007 15:14:11 -0400
What you're trying to do there is find situations that are suited to not
using exit for.
That's usually how one makes a point.
I care. If someone goes to extensive lengths to avoid using exit function
or exit for then the code becomes less readable.
Only to someone who's not used to that coding style. For myself, I find it
no more or less readable either way. I just don't necessarily know where my
exit points are when using Exit For; when not using it, however, I know that
any code not bracketed by If's and the like WILL run for each iteration
until the conditions are satisfied.
The example given by the OP was significantly more difficult to read and
it was a very simple loop.
The only thing that made it more difficult to read for me was the length of
his variable names.
In more complex loops it could become quite difficult to write and
maintain and there really is no benefit except to adhere to some self made
preconception of the programmer.
At least one benefit was listed above. As for being difficult to write and
maintain in more complex loops, I generally don't find it makes any
difference whatsoever. You get the same one or two extra lines of overhead
code due to the difference in style, and the rest of your loop stays the
same.
By the same token, one who's even more immersed in structured programming
than I am might well find it more difficult to figure out what's going on
with the Exit For strategy. When you get right down to it, pretty much any
argument either of us makes for or against can be applied in reverse as
well. The simple fact is that some people don't like one method or the
other, as it offends their sensibilities, but in reality, there's points for
and against each method. In the end, any programmer thinking of taking over
someone else's project should expect differences in coding style that they
may find more difficult to read, not being used to it, but should be
well-enough versed in all methods not to care significantly unless there's
something TRULY awful about the code (like iterating instead of looping, for
instance).
Rob
.
- Follow-Ups:
- Re: how do people feel about exit function from loop
- From: Michael C
- 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
- 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
- Re: how do people feel about exit function from loop
- From: Michael C
- how do people feel about exit function from loop
- Prev by Date: Show graphics form like in Access
- Next by Date: Re: Compacting a Random created file
- 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
|