Re: how do people feel about exit function from loop
- From: dNagel <NOTGrandNagel@xxxxxxxxxxx>
- Date: Sun, 29 Jul 2007 21:03:24 -0700
Robert Morley wrote:
...Excellent points...
SomeLoop: Debug.Print "Hello"
Goto SomeLoop
or
While True
Debug.Print "Hello"
Wend
or
For i = 1 To 2
i = i - 1
Debug.Print "Hello"
Next
...
There has to be a reason to use a GoTo as well as any other looping construct...
I would consider that in the circumstance where the loop required optimization
you would have to at least consider all three of these equivalent code sources to
be able to prove that one were faster than another... Compilers have a tendency
to interpret what we write in different ways, even when we are telling them to
logically do the exact same thing each time.
also...
You should always consider using the most readable or "simple" logic when
writing code so that you and your coworkers or successors at least have a
chance at understanding what you wrote some day later on... This does not
necessarily mean small, like goto, it means in English, or what ever language
you speak, it is written how you would say it to someone else. When you
speak to others in code as you would speak to them inter-personally there is
often a greater chance that they will follow what you're saying in the code
and actually comprehend what you're doing much faster; they are more
likely to be able to identify errors as well as understand what they see.
Walk through your code and count the number of lines between initialization
and the last use of your variables... The higher that number; the less readable
your code becomes... It may work but it takes too much concentration to
follow it as you're working out a problem or making enhancements. It winds
up costing more to support and maintain in the long run.
D.
//
//
.
- 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
- 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
- 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
- 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
|