Nino add up @Wiki
if文
最終更新:
nino-add-up
-
view
関係演算子
- x1 < x2 : ( x1 .lt. x2 )
- x1 <= x2 : ( x1 .le. x2 )
- x1 > x2 : ( x1 .gt. x2 )
- x1 >= x2 : ( x1 .ge. x2 )
- x1 = x2 : ( x1 .eq. x2 )
- x1 ≠ x2 : ( x1 .ne. x2 )
※ x1とx2の型が違う場合,広い型に変換してから比較される.
論理演算子
- 否定 : .not. ( condition1 ))
condition1が真なら偽,偽なら真
- 論理積 : (( condition1) .and. ( condition2 ))
condition1,condition2ともに真なら真,それ以外は偽
- 論理和 : (( condition1) .or. ( condition2 ))
condition1,condition2ともに偽なら偽,それ以外は真
- 論理等価 : (( condition1) .eqv. ( condition2 ))
condition1,condition2ともに真またはともに偽のとき真,それ以外は偽
- 論理非等価 : (( condition1) .neqv. ( condition2 ))
condition1,condition2ともに真またはともに偽のとき偽,それ以外は真
使い方いろいろ
- endなしで使える.9999はstopのこと.
if ( condition ) goto 9999
- 条件がひとつだけでいい場合.
if ( condition ) then
process
endif
process
endif
- 条件がいくつかある場合.
if ( condition1 ) then
process1
elseif ( condition2 ) then
process2
endif
process1
elseif ( condition2 ) then
process2
endif
- それ以外という条件.
if ( condition1 ) then
process1
else
process2
endif
process1
else
process2
endif
- 条件がいくつか同時に指定したい場合.
if ((condition1) .and. (condition1)) then
process
endif
process
endif
[PR] メールフォーム