0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Fortran90覚え書き (超基本)

Last updated at Posted at 2020-07-31

とても基本的なことなのだが、他の言語と混ざっていつまで経っても覚えられない(覚える気がない)のでメモ。

比較演算子

演算子 意味
.lt. <
.le. <=
.eq. ==
.ne. /=
.gt. >
.ge. >=

論理演算子

演算子 意味
.not. ノットイコール
.and. &
.or. もしくは
.eqv. 論理値が等しい
.neqv. 論理値が等しくない

引数の取得

文字列としての取得になるので、数値の場合はreadし直す必要がある。

sample.f90
program sample
	implicit none
	integer         :: nmax
	character(256)  :: arg

	if( iargc() == 2 ) then
  		call getarg(1,arg)
		read(arg,*) nmax
        	call getarg(2,arg)
		open(90,file=trim(arg))
	else 
		!---引数が2つでなければ、適当な値/文字列を使用
		nmax=1000
		open(90,file="tmp.dat")
	end if
end program
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?