|
Part 1: An Introduction to Structured
Techniques
by George Martin
Start ý Sequence
ý Selection ý Iteration/Looping
ý Testing ý Nassi-Schneiderman
Charts ý Sources and PDF
ITERATION/LOOPING
The third structural element is iteration,
or looping. In this situation, the condition is tested, and if it
is true, then process F is executed and the test is repeated. If the
condition is not true, then the program continues. This is commonly
called the while loop (see Figure 4).
|
|
| Figure 4ýWhen the condition
is false, the program continues. This is called a while loop. |
A slight variation in the construction
of this structure is called the until loop, which can be seen
in Figure 5.
|
|
| Figure 5ýA minor dissimilarity
in the construction of Figure 4 is what you see here. This is
called an until loop. |
Now, letýs look at what we have. I contend
that all of your code can be written using the three structures I
just defined. You can define more structures, such as a case or switch
structure, which may make your design more compact or understandable.
There are provisions in most languages for this. BASIC has its case
statement, and C has its switch statement. But, you can construct
either of those out of the three structures shown in this article.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ýCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |