Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!bionet!ames!purdue!haven!adm!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.fortran Subject: Re: Is this a correct Fortran 88 subroutine? Summary: How about this syntax instead? Message-ID: <14040@lanl.gov> Date: 8 Sep 89 22:19:35 GMT References: <790hallidayd@yvax.byu.edu> Organization: Los Alamos National Laboratory Lines: 37 > SUBROUTINE X(L) > LOGICAL L > IF: IF ( L ) THEN > ELSEIF ! This is not an ELSEIF statement > ENDIF IF > END I have always favored a syntax in which block names _always_ appear on the left: IF: IF( L ) THEN ... IF: ELSE ... IF: ENDIF Here, the visual ambiguity is gone (there never was any computational ambiguity). Some people regard this is ugly, but if the purpose of block names is as a documentation aid as well as a flow control aid, then this syntax serves the purpose well. All the block names are easier to find on the left and will line up on properly indented code. Here is an example with loops: LOOP: DO I=1,1000 ... LOOP: EXIT IF (COND) !EXITS CAN BE CONDITIONAL ... LOOP: EXIT !OR UNCONDITIONAL ... LOOP: END DO Of course, CYCLE and CYCLE IF statements are also possible. Note the with the block name on the left, there is never any doubt about which statements on the page have a flow control effect - and no doubt about which construct they belong to. With the block names on the right, they are effectively buried in the middle of the program text.