24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Language</strong> <strong>Reference</strong><br />

9.12 GUESS-ADMIT-END GUESS<br />

GUESS [: block-label]<br />

statement(s)<br />

ADMIT<br />

statement(s)<br />

ADMIT<br />

statement(s)<br />

.<br />

.<br />

.<br />

ADMIT<br />

statement(s)<br />

END GUESS<br />

The GUESS-ADMIT-END GUESS structure is a rejection mechanism which is useful when sets of<br />

statements are to be conditionally chosen for execution, but not all of the conditions required to make a<br />

selection are available beforehand. It is an extension to <strong>FORTRAN</strong> <strong>77</strong>. The sets of statements to be chosen<br />

may be thought of as alternatives, the first alternative being statements immediately after the GUESS<br />

statement. Execution begins with the statements in the first alternative. If a condition is detected which<br />

indicates that the first alternative was the wrong choice, a QUIT statement may be executed to cause<br />

control to be passed to the statements after the ADMIT statement (i.e., the second alternative). A QUIT<br />

statement within the second alternative passes control to the third alternative, etc. A QUIT statement<br />

within the last alternative passes control to the statement after the END GUESS statement. If an alternative<br />

completes execution without encountering a QUIT statement (i.e., all statements are executed up to the next<br />

ADMIT statement) then control is passed to the statement after the END GUESS statement. An optional<br />

block label may be specified following the keyword GUESS (see the QUIT statement for more<br />

information).<br />

In the following example, two sets of codes and numbers are read in and some simple sequence checking is<br />

performed. If a sequence error is detected an error message is printed and processing terminates; otherwise<br />

the numbers are processed and another pair of numbers is read.<br />

206 GUESS-ADMIT-END GUESS

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!