home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / fortran / 3118 next >
Encoding:
Text File  |  1992-08-23  |  1.1 KB  |  42 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!cs.utexas.edu!hermes.chpc.utexas.edu!rshouman
  3. From: rshouman@chpc.utexas.edu (Radey Shouman)
  4. Subject: Re: Low level routines to do logical shifts
  5. Message-ID: <1992Aug23.202912.26431@chpc.utexas.edu>
  6. Keywords: lshft,rshft etc.
  7. Organization: The University of Texas System - CHPC
  8. References: <1992Aug18.174715.25954@uceng.UC.EDU> <134179@lll-winken.LLNL.GOV>
  9. Date: Sun, 23 Aug 92 20:29:12 GMT
  10. Lines: 30
  11.  
  12. In article <134179@lll-winken.LLNL.GOV> stevep@phoenix.ocf.llnl.gov (Steve J Patenaude) writes:
  13.  
  14.     [...]
  15.  
  16. >First, to do a <while> loop in Fortran 77, you must use the
  17. >dreaded -gasp- GOTO!
  18. >
  19. >C FORTRAN FOR 'while (foo < finished) foo += incr;'
  20. >1     IF (FOO .GE. FINISHED) GOTO 2
  21. >      FOO = FOO + INCR
  22. >      GOTO 1
  23. >C END OF WHILE LOOP
  24. >2   ...
  25.  
  26. A somewhat neater (one less statement label) way to do this is to use 
  27. a fortran77 block if:
  28.  
  29.  1    IF (FOO .LT. FINISHED) THEN
  30.           FOO = FOO + INCR
  31.       GOTO 1
  32.      ENDIF
  33.  
  34. Of course, for this particular example, a DO loop might well be preferable.
  35.  
  36.  
  37.  
  38.  
  39.  
  40. -- 
  41. Radey Shouman                    rshouman@chpc.utexas.edu
  42.