If: Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= if = | |||
Usage: if (''condition'') ''command'' {''parameter''} | Usage: if (''condition'') ''command'' {''parameter''} | ||
if (''condition'') then | if (''condition'') then |
Latest revision as of 19:18, 28 January 2009
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