Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!bcm!dimacs.rutgers.edu!rutgers!cmcl2!sbcs!csws5.ic.sunysb.edu!mlubran From: mlubran@csws5.ic.sunysb.edu (Michael J Lubrano) Newsgroups: comp.lang.fortran Subject: Re: Is this kosher? Message-ID: <1991Mar6.154720.1162@sbcs.sunysb.edu> Date: 6 Mar 91 15:47:20 GMT References: <2787@dftsrv.gsfc.nasa.gov> <1991Mar05.033656.1146@mojsys.com> Sender: usenet@sbcs.sunysb.edu (Usenet poster) Distribution: na Organization: State University of New York at Stony Brook Lines: 38 >In article <2787@dftsrv.gsfc.nasa.gov> jim@jagubox.gsfc.nasa.gov (Jim Jagielski) writes: >>[ommitted stuff] >> . >> if (value .lt. 0) then >> . >> else >>22 do something >> . >> end if >> . >> if (a.lt.b) goto 22 >> >>Is the above legal and acceptable... I can't find any references to it in my >>books... > A much better way to write this would be: 10 IF (VAL.LT.0)THEN . ELSE C DO SOMETHING . END IF . C FORCE PROGRAM FLOW IF(A.LT.B)THEN VAL=100 GO TO 10 END IF setting VAL greater than 0 forces the conditional (VAL.LT.0) to defualt to the else, which is exactly where you want to be. Q.E.D Mike Lubrano