0

I have to understand this Fortran code for coding the same in Python, but I don't get these conditionals.

#1: For example: if(n-kv) there aren't conditions, just an integer(n-kv). How does it work?

#2: After that, there are numbers. For example: if(n-kv)30,20,20 or if(kv) 50,50,40. What is the use of these numbers?

      do 100 l=1,nbn
       l1=2*l-1
       no=ib(l1)
       k1=no-1
       kr=k1+1
       do 50 j=2,ms
        kv=kr+j-1
        if(n-kv)30,20,20
20      tk(kr,j)=0
30      kv=kr-j+1
        if(kv) 50,50,40
40      tk(kv,j)=0
50     continue
       tk(kr,1)=1
100   continue 

      end

Note: don't care about the variables, I am just trying to understand how Fortran works with this kind of conditionals.

  • Welcome to Stack Overflow. Please read [ask]. Please only use question tags to describe *the question that you need answered* - not for underlying context. This is **not a discussion forum**, so it *doesn't actually matter to us* why you need an answer to the question. I have removed the Python tag. – Karl Knechtel Feb 14 '23 at 18:47
  • I think the intricacies of porting this code to python merit a re-open vote as it goes beyond the Fortran branching syntax. – John Alexiou Feb 14 '23 at 18:52
  • 1
    I disagree. Once the logic is explained, the porting bit is trivial unless the jumps go to some wild locations. If they do, then it is a generic problem of converting spaghetti code to structured Python. Theoretically there could be a specific question of "How to convert Fortran artihmetic if to Python" but I am skeptical to achiaveble quality of such a question. Explaining and then converting is already quite broad. Or even too broad and may call for a close by itself. – Vladimir F Героям слава Feb 14 '23 at 21:24

0 Answers0