Why does the second if-clause even execute?

前端 未结 2 1035
无人共我
无人共我 2021-01-24 11:23

I have a do while loop in my program, who\'s condition to continue keeps giving me off-by-one errors and I can\'t figure out why. It looks like this:



        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-24 11:58

    Extending the answer High Performance Mark, here is one way to rewrite the loop:

    ii_loop: do
    
      if (ii .gt. nri) exit ii_loop
      if (ed(ii) .gt. e1) exit ii_loop
    
      ! do some stuff
    
      ii = ii + 1
    
    end do ii_loop
    

提交回复
热议问题