February 17, 2009
The development of FORTRAN. A story of innovation. The 25th Anniversary of FORTRAN video.
TEST on Thursday.
Test will be multiple choice and essay questions.
Press Spacebar to continue
When a language allows different variables to have the same name, it must have some way to ensure that each use of the name is unambiguous. This means there must be some way to control the scope of definitions.
fun square n = n * n;
fun twotmes n = n + n;
int main () {
int n = 3;
int m;
m = n + 5;
printf m;
{
int n = 6;
m = n + 4;
printf m;
}
printf m;
}
return cube * cube * cube;
Press Spacebar to continue
1 program main;
2 var x: integer;
3 procedure Q(var i:integer; function R(j:integer):integer);
4 var x: integer;
5 begin
6 x := 4;
7 writeln('before call to R', i,x);
8 i := R(i);
9 writeln('after call to R',i,x);
10 end;
11 procedure P;
12 var i : integer;
13 function FN(k : integer):integer;
14 begin
15 x := x + k;
16 FN := i + k;
17 writeln('in FN',i,x);
18 end;
19 begin
20 i := 2;
21 Q(x,FN);
22 writeln('in P', i, x);
23 end;
24 begin
25 x := 7;
26 p;
27 writeln('in main',x);
28 end.
Press Spacebar to continue
