在for循环中关于fortran continue语句的问题 [英] question about fortran continue statement in a for loop
本文介绍了在for循环中关于fortran continue语句的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道下面的代码在100和200处的continue语句是什么。
是否增加i和j计数器?如果是这样,那么不会如果(.not。flg)
则条件包含code> flg 值价值的循环 j = i + 1到N
?
do 100 i = 1,N-1
flg = .false。
do 200 j = i + 1,N
if(my condition)flg = .true。
200继续
if(.not。flg)then
!在这里做点什么。
endif
100 continue
解决方案
AFAIK,Fortran中的CONTINUE不做任何事情。
它仅用于DO循环语义的方便。
这不像C。
I am analyzing a code in fortran and have a simple question.
I want to know what the "continue" statement at 100 and 200 in the code below does.
Does it increment the i and j counters? If so, wouldn't if( .not. flg )
then condition contain the flg
value that is the "last value" of flg in the loop j = i+1 to N
?
do 100 i = 1, N-1
flg = .false.
do 200 j = i+1, N
if( "my condition" ) flg = .true.
200 continue
if( .not. flg ) then
! do something here.
endif
100 continue
解决方案
AFAIK, CONTINUE in fortran does nothing.
It's used only for convenience in DO loop semantics. This is not like C.
这篇关于在for循环中关于fortran continue语句的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文