If

From CYANA Wiki
Jump to navigation Jump to search

if

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