break/continue - newbe

John Machin sjmachin at lexicon.net
Tue Dec 21 22:30:38 CET 2004


Ann wrote:
> I have trouble sometimes figuring out where
> break and continue go to. Is there some easy
> way to figure it out, or a tool?
> TIA
> Ann

You need a tool called py2ftn. It would convert statements like "if a >
b: break" to e.g. "IF(A.GT.B)GOTO12345".

A longer example; this:

while 1:
blah1
if cond1: break
blah2
if cond2: continue
blah3

becomes:

10000 IF(1)10001,10003,10001
10001 CONTINUE
BLAH1
IF(COND1)GOTO10003
BLAH2
IF(COND2)GOTO10002
BLAH3
10002 CONTINUE
      GOTO10000
10003 CONTINUE

HTH,
John




More information about the Python-list mailing list