! 学習目的:if文 ! ex301.f character s*1 n=1 if(n.eq.1) write(*,*) n write(*,*) if(1.eq.n) write(*,*) n ! 変数を.eq.のどちら側でもよい write(*,*) s='y' if(s.eq.'y') write(*,*) 'yes' write(*,*) a=3. if( a.le.5.0 .and. a.gt.1.d0) write(*,*) a write(*,*) stop end ! if()の()の論理式が真なら右側の実行文が実行される. !論理式 !@ .eq. =  .ne. =/= (変数には,整数型,実数型,文字型が使用可) !A .gt. > .ge. >= (変数には,整数型,実数型) !B .lt. < .le. <= (同上) !C ( a.eq.b .or. a.eq.c) 意味:a=bまたはa=c !D ( a.le.b .and. a.gt.c) 意味: c < a <= b !E (( a.le.b .and. a.gt.c) .or. a.le.d) (c < a <= b)またはa<=d