MCDOWELL@kcgl1.eng.ohio-state.edu (James K. McDowell) (09/10/89)
How will 8X interpret this piece of code in both the
fixed and freeform modes ?
PROGRAM TEST
I = 1
J = 2
IF ( I .EQ. 1 ) THEN J = 1
WRITE(6,*) I, J
STOP
END
This is a favorite of mine and I use it as an example
for teaching my students. The program is correct under
F77 with "WRITE(6,*) I, J" displaying a value of 1 for I
and a value of 2 for J.
thanx in advance.
>>> Jim
James K. McDowell
Department of Chemical Engineering
College of Engineering
The Ohio State University
mcdowell@kcgl1.eng.ohio-state.edu
jlg@lanl.gov (Jim Giles) (09/11/89)
In article <2995@quanta.eng.ohio-state.edu>, MCDOWELL@kcgl1.eng.ohio-state.edu (James K. McDowell) writes: > How will 8X interpret this piece of code in both the > fixed and freeform modes ? > PROGRAM TEST > I = 1 > J = 2 > IF ( I .EQ. 1 ) THEN J = 1 > WRITE(6,*) I, J > STOP > END In 8x fixed mode, the result is I prints as 1, J prints as 2, and the value of the variable THENJ will be 1. In 8x freeform mode the program is illegal since the keyword THEN is valid only for block IFs and the syntax <id> <id> is not a valid beginning of any executable statement.
mac@harris.cis.ksu.edu (Myron A. Calhoun) (09/12/89)
In article <2995@quanta.eng.ohio-state.edu> MCDOWELL@kcgl1.eng.ohio-state.edu (James K. McDowell) writes:
* How will 8X interpret this piece of code in both the
* fixed and freeform modes ?
* PROGRAM TEST
* I = 1
* J = 2
* IF ( I .EQ. 1 ) THEN J = 1
* WRITE(6,*) I, J
* STOP
* END
TERRIBLE! THEN J is a variable under F77. Fortunately, any GOOD
programmer instructs hizer compiler/system to flag all undeclared
variables; my f77 compiler on this harris unix system immediately
told me there was something "funny" in that IF statement.
--Myron
--
Myron A. Calhoun, PhD EE, W0PBV, (913) 532-6350 (work), 539-4448 (home).
INTERNET: mac@ksuvax1.cis.ksu.edu
BITNET: mac@ksuvax1.bitnet
UUCP: ...{rutgers, texbell}!ksuvax1!harry!mac