Re: how do people feel about exit function from loop



Robert Morley wrote:
...
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

...
Excellent points...

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.
//
//
.



Relevant Pages

  • Re: Another Week Comes to a Close
    ... I sit in the nonsmoking whenever I get a chance. ... been a little quicker to speak Id have been sitting there that day too!!Good ... to speak up,she said "we dont smoke but we dont care" So wouldnt ya ... There was nobody in there smoking,which wouldnt have bothered me. ...
    (alt.support.stop-smoking)
  • Re: What Really Happens In A Gunfight?
    ... I suspect that was rhetorical and that, yeah, that it's of no special ... IF I SEE A CHANCE TO BLAME SOMETHING ON WILLIAMS, ... Otoh, I speak up when I read things I agree with, too. ...
    (misc.fitness.weights)
  • Re: carrer opportunities
    ... chance to speak with you confidentially about opportunities with my ... It would be a chance for me to better understand your ... experience, background, and qualifications and speak with you about ... Please Reply to the Newsgroup ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Last Scot civil war fighter dies
    ... If Mexicans speak Spanish, WTF do the Spanish speak?- Hide quoted ... The less chance we have of being killed." ... - William Topaz McGonagall ... When was the French royal emblem, Fleur-de-lis, removed from the English Royal coat of arms? ...
    (soc.culture.scottish)
  • Re: More FOAK: Setting up my new PC
    ... goto here www.cmilabsplc.com ... speak to the freindly sales team, they will send you either AV or IS by post ...
    (uk.rec.motorcycles)