Last Updated: February 25, 2016
·
890
· skopp

Info Byte: FORTRAN & DATA

The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793... at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant.

This also simplifies modifying the program, should the value of pi change.

FORTRAN manual for Xerox Computers

4 Responses
Add your response

Thanks for the bit :)
Isn't the same accomplished with PARAMETER statement?
Or does it have some advantages to it?

over 1 year ago ·

Good question. I think you may well be right. FORTRAN is not really my...uh, forte :)
I think this is from the editions of the language around '77', '66' or one or two before it. I'm not sure why, but it would appear that the "DATA" statement is obsolete (http://goo.gl/I9ISp), I'm guessing the PARM statement is of its successors.

See also (http://goo.gl/gaTPj)

over 1 year ago ·

Yup, it's obsolete alright.
F90 didn't have it actually removed, rather marked as "obsolescent", meaning it for future removal.

over 1 year ago ·

Cool. I just find the history of computing, logic systems and computer systems in general quite interesting.

I read also that 'FORTRAN' is now stylized as simply 'Fortran' - but you probably knew that I presume. If not, another 'info byte' for you there ;)

over 1 year ago ·