Koding:
program ContohForward2;
uses
crt;
procedure Tulis(var N: integer); forward;
procedure TurunkanNilai (var indeks: integer);
begin
indeks := indeks -1;
if indeks > 0 then begin
Tulis(indeks);
end;
end;
procedure Tulis(var N: integer);
begin
writeln(N);
TurunkanNilai(N);
end;
var
i : integer;
begin
i := 5;
writeln('Menggunakan prosedur TurunkanNilai');
TurunkanNilai(i);
writeln;
i := 5;
writeln('Menggunakan prosedur Tulis');
Tulis(i);
readln;
end.
Output :
program ContohForward2;
uses
crt;
procedure Tulis(var N: integer); forward;
procedure TurunkanNilai (var indeks: integer);
begin
indeks := indeks -1;
if indeks > 0 then begin
Tulis(indeks);
end;
end;
procedure Tulis(var N: integer);
begin
writeln(N);
TurunkanNilai(N);
end;
var
i : integer;
begin
i := 5;
writeln('Menggunakan prosedur TurunkanNilai');
TurunkanNilai(i);
writeln;
i := 5;
writeln('Menggunakan prosedur Tulis');
Tulis(i);
readln;
end.
Output :