The language also included constructs for conditional branching, looping, and I/O (input and output).
Here is the FORTRAN statement that will add two numbers and store the result in a third location. The
variable names X, Y, and Z become labels for memory locations, and this statement says to add the contents of
location Y to the contents of location Z, and store the sum in location X:
X = Y + Z
Compared to assembly language, that??™s quite a gain in writeability and readability!
FORTRAN is a ???procedural language???. Procedural languages seem quite natural to people with a background
in automation and engineering. The computer is a flexible tool, and the programmer??™s job is to lay out the
CHAP. 4] SOFTWARE 45
sequence of steps necessary to accomplish the task. The program is like a recipe that the computer will follow
mechanically.
Procedural languages make up one category of ???imperative languages,??? because the statements of the language
are imperatives to the computer??”the steps of the program specify every action of the computer. The other
category of imperative languages is ???object-oriented??? languages, which we will discuss in more detail later.
Most programs today are written in imperative languages, but not all .
Pages:
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131