Re: how do people feel about exit function from loop



with the authors permission, I'm posting the content of the previous link I gave...




Chapter 16: Controlling Loops

*Loop Selection and Creation*

* Is a /while/ loop used instead of a /for/ loop, if appropriate?
* Was the loop created from the inside out?

*Entering the Loop*

* Is the loop entered from the top?
* Is initialization code directly before the loop?
* If the loop is an infinite loop or an event loop, is it
constructed cleanly rather than using a kludge such as /for i = 1
to 9999/?
* If the loop is a C++, C, or Java for loop, is the loop header
reserved for loop-control code?

*Inside the Loop*

* Does the loop use /{/ and /}/ or their equivalent to prevent
problems arising from improper modifications?
* Does the loop body have something in it? Is it nonempty?
* Are housekeeping chores grouped, at either the beginning or the
end of the loop?
* Does the loop perform one and only one function-as a well-defined
routine does?
* Is the loop short enough to view all at once?
* Is the loop nested to three levels or less?
* Have long loop contents been moved into their own routine?
* If the loop is long, is it especially clear?

*Loop Indexes*

* If the loop is a for loop, does the code inside it avoid monkeying
with the loop index?
* Is a variable used to save important loop-index values rather than
using the loop index outside the loop?
* Is the loop index an ordinal type or an enumerated type-not
floating point?
* Does the loop index have a meaningful name?
* Does the loop avoid index cross talk?

*Exiting the Loop*

* Does the loop end under all possible conditions?
* Does the loop use safety counters-if you've instituted a
safety-counter standard?
* Is the loop's termination condition obvious?
* If /break/ or /continue/ are used, are they correct?


This material is copied and/or adapted from the Code Complete 2 Website at cc2e.com. This material is Copyright © 1993-2007 Steven C. McConnell. Permission is hereby given to copy, adapt, and distribute this material as long as this notice is included on all such materials and the materials are not sold, licensed, or otherwise distributed for commercial gain.

D.

.



Relevant Pages

  • Re: Loop antenna success story
    ... Could you give the dimensions of the loop, ... And the size of the materials? ... And maybe a link to a picture? ...
    (rec.radio.amateur.antenna)
  • Re: Parameterize the number of I/O ports
    ... I can use a for loop within a always@combinatorial loop and use the ... for loop index to extract what I need. ... range in a part select must be specified with constant expressions. ... it specifies a starting bit position and a ...
    (comp.lang.verilog)
  • Re: FOR loops running backwards
    ... the index is used as an lvalue or an rvalue, ... - No external code is called in the loop. ... The loop index may be used to generate lvalues. ... - The loop may not generate an exception at any point. ...
    (alt.comp.lang.borland-delphi)
  • Re: Parameterize the number of I/O ports
    ... I can use a for loop within a always@combinatorial loop and use the ... for loop index to extract what I need. ... range in a part select must be specified with constant expressions. ...
    (comp.lang.verilog)
  • Re: Macro Assessment
    ... Greg Maxey/Word MVP ... >> Dim oSggs As SpellingSuggestions ... > This is a more-subtle case of what happens when a loop using a counter ... > *not* affect the stop value of the loop index. ...
    (microsoft.public.word.vba.general)