next up previous contents
Next: IF Construct Up: Control Flow Previous: Control Flow

IF Statement

The basic form is,

 
IF( tex2html_wrap_inline43037  logical-expression  tex2html_wrap_inline43039 ) tex2html_wrap_inline43037  exec-stmt  tex2html_wrap_inline43039 

If tex2html_wrap_inline43037  logical-expression tex2html_wrap_inline43039 evaluates to .TRUE. then the tex2html_wrap_inline43037  exec-stmt tex2html_wrap_inline43039 is executed otherwise control of the program passes to the next line.

A tex2html_wrap_inline43037  logical-expression tex2html_wrap_inline43039 is often:

 
 tex2html_wrap_inline43037  expression  tex2html_wrap_inline43039  tex2html_wrap_inline43037  relational-operator  tex2html_wrap_inline43039  tex2html_wrap_inline43037  expression  tex2html_wrap_inline43039  

For example,

    IF (bool_val) A = 3
    IF (x .GT. y) GOTO 56
    IF (i .NE. 0 .AND. j .EQ. 0) k = 1/(k*j)
    IF (i /= 0 .AND. j == 0) k = 1/(k*j) ! same

When using real-valued expressions (which are approximate) .EQ. and .NE. have no real meaning.

For more information, click here gif


next up previous contents
Next: IF Construct Up: Control Flow Previous: Control Flow

Adam Marshall ©University of Liverpool, 1996
Fri Dec 6 18:56:08 GMT 1996
Not for commercial use.