IF

IF.TXT 14-OCT-96

The IF statement is useful for MAIN programers, especially for loop control.

IF ( value operator value ) a main command sentence

Comparison operators are:

Values can be integer or real numbers and strings. You can only compare values of the same type.

Brackets are obligatory.

When the expression specified ( ... ) is evaluated as true, then the subsequent command sentence is interpreted, otherwise the command interpreter skips to the next input line.

To apply loops a loop counter variable should be defined and the IF statement can serve either to repeat the loop or exit from the command file:


> set variable iatom = iatom + 1
> if ( iatom .gt. natom ) return
> set center atom iatom
> show image center
> rewind file