tags:

views:

165

answers:

3

hi, 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
+3  A: 

AFAIK, CONTINUE in fortran does nothing.

It's used only for convenience in DO loop semantics. This is not like C.

Pavel Radzivilovsky
+3  A: 

Th CONTINUE statement simply marks the end of the loop indicated by its numeric statement number - it doesn't increment anything. It certainly has no effect on flg in your code. There's a simple explanation of its use here.

anon
.......thanks Neil !
memC
+1  A: 

This is old Fortran, which used typically used labeled continue statements to mark do loops. Fortran 90 and later provides an "end do" statements.

M. S. B.