next up previous contents index
Next: IMPORT Up: SIC Language Internal Help Previous: HELP   Contents   Index


IF

        [SIC\]IF Logical_Expression [THEN]
        [SIC\]IF Logical_Expression Command [Arguments]

    The first form starts a conditional IF block. The behaviour of IF blocks
    is similar to structured Fortran. The THEN keyword is optional.
    The second form defines a logical IF statement, i.e. it  uses  a  single
    line  with  no possibility of alternate execution (no ELSE choice). When
    the argument following the logical expression is not THEN, it is assumed
    to  be a command which will be interpreted, together with the next argu-
    ments, if the logical expression evaluates as true.

    This command can only be used within a procedure: interactive users  are
    expected to be able to make their decisions themselves.

    There must be no blanks within the logical expression, but composite ex-
    pressions are allowed. Two special logical functions can also be used:
      - EXIST(VarName) Returns .TRUE. if VarName is an existing variable
      - FILE("String") Returns .TRUE. if String is an existing file.  Double
          quotes  protect  the  case of the string. Syntax FILE("'VarName'")
          allows to check the string contained in a character variable.


Gildas manager 2014-07-01