INCLAN: if: Difference between revisions

From CYANA Wiki
Jump to navigation Jump to search
m (1 revision)
 
m (1 revision)
(No difference)

Revision as of 12:26, 29 January 2009

Usage: if (condition) command {parameter}

      if (condition) then
        .
        .
      else if (condition) then
        .
        .
      else
        .
        .
      end if

The "if" statement allows for Fortran-77 style logical or block if statements. A logical "if" statement must not end with the word "then".

Example: if (i.gt.0) then

          print "$i is greater than 0."
        else if (def(x) .and. exist(y)) then
          print "The variable x is defined, and the variable y exists."
        else if (string.ne. ) then
          print "The variable string has the non-blank value $string."
          if (mod(j,2).eq.1) print "j is odd."
        end if