23.01.2015 Views

STANDARD HANDBOOK OF PETROLEUM & NATURAL GAS ...

STANDARD HANDBOOK OF PETROLEUM & NATURAL GAS ...

STANDARD HANDBOOK OF PETROLEUM & NATURAL GAS ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Computer Applications 129<br />

WRITE(filename, a,b,c,d);<br />

can then write four items to the file.<br />

RESET(fi1ename);-Prepares a file for reading, beginning with the first item<br />

in the file, and<br />

READ(filename,X);<br />

can then read the first item from the file.<br />

Control statements-Affect the flow of statement execution within a program<br />

unit (see subprogram statements below for passing of control between units).<br />

The only general control statement in Pascal (which is rarely needed) is:<br />

GOT0 line number;-Shifts control to the statement beginning at the<br />

specified line number.<br />

Conditional statements may be nested with other conditional statements and/<br />

or with iterative statements. They are:<br />

IF boolean statement THEN statement-Where statement may be a simple or<br />

a compound statement (for boolean and relational operators, see Table 1-29)<br />

and<br />

IF boolean statement<br />

THEN statement 1<br />

ELSE statement 2-where the statements are as defined above<br />

For example,<br />

IF (PRSSR < MINP) OR (PRSSR MAXP) THEN<br />

BEGIN<br />

X(P1PENUM: = PREVX;<br />

CORRPR( PRSSR,X( PIPENUM),AVT)<br />

END<br />

ELSE<br />

PREVX: = X(IP);<br />

and<br />

CASE selector expression <strong>OF</strong><br />

label: statement;<br />

label: statement;<br />

...<br />

label: statement<br />

END<br />

where, when the selector expression is evaluated, producing an ordinal value,<br />

the statement following the label value which matches the selector expression<br />

is executed, e.g.,<br />

CASE PIPENUM <strong>OF</strong><br />

1: PREV: = FALSE;<br />

MAXP: NEXT = FALSE<br />

END:

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

Saved successfully!

Ooh no, something went wrong!