To install click the Add extension button. That's it.

The source code for the WIKI 2 extension is being checked by specialists of the Mozilla Foundation, Google, and Apple. You could also do it yourself at any point in time.

4,5
Kelly Slayton
Congratulations on this excellent venture… what a great idea!
Alexander Grigorievskiy
I use WIKI 2 every day and almost forgot how the original Wikipedia looks like.
Live Statistics
English Articles
Improved in 24 Hours
Added in 24 Hours
What we do. Every page goes through several hundred of perfecting techniques; in live mode. Quite the same Wikipedia. Just better.
.
Leo
Newton
Brights
Milds

Zahn's construct

From Wikipedia, the free encyclopedia

Zahn's construct, in computer science, was a proposed structure for structured control flow in computer programming languages first described by Charles T. Zahn in 1974.[1] The construct is primarily described in terms of an extension to looping constructs to recognize multiple means by which a loop could terminate. For example, a search loop might terminate early, when the target is found; or it might terminate after the search has been completed unsuccessfully. Zahn's construct can be used to avoid GO TO statements when determining which case was encountered. Zahn does this by introducing a new kind of variable called a situation indicator in a CASE-like construct following the loop.

Donald Knuth, in his paper "Structured Programming with Go To Statements",[2] describes two forms of Zahn's construct as follows:

loop until <situation 1> or ... or <situation n>:
  <statement list 0>
repeat;
then <situation 1> => <statement list 1>;
 ...
     <situation n> => <statement list n>;
fi

and:

begin until <situation 1> or ... or <situation n>:
  <statement list 0>;
end;
then <situation 1> => <statement list 1>;
 ...
     <situation n> => <statement list n>;
fi

There must also be a statement to set a specific situation indicator and exit the body of the construct.

The following simple example involves searching a two-dimensional table for a particular item.

exitwhen found or missing;
    for I := 1 to N do
        for J := 1 to M do
            if table[I,J] = target then found;
    missing;
exits
    found:   print ("item is in table");
    missing: print ("item is not in table");
endexit;

Try-catch blocks, used in modern programming languages for exception handling, are variations of Zahn's construct. The major difference is that the scope of Zahn's proposals were limited to individual loops within a program, whereas exception-handling capabilities often allow exceptions to be "thrown" from deep within a call stack and "caught" at a point higher up in the stack.

References

  1. ^ Zahn, C. T. "A control statement for natural top-down structured programming" presented at Symposium on Programming Languages, Paris, 1974.
  2. ^ Knuth, D. E. "Structured Programming with Go To Statements" Archived 2013-10-23 at the Wayback Machine, Computing Surveys, Volume 6, December 1974, page 275

External links

This page was last edited on 17 January 2024, at 20:45
Basis of this page is in Wikipedia. Text is available under the CC BY-SA 3.0 Unported License. Non-text media are available under their specified licenses. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. WIKI 2 is an independent company and has no affiliation with Wikimedia Foundation.