Master BAW
2012-06-13 09:05:12
program test;
procedure a;
var
x: integer;
begin
x := random(10); //0 tot 9
Writeln(IntToStr(x) + ' ');
if(random(3) = 2) then a;
end;
procedure b;
var
x: integer;
begin
x := random(20)+10; //10 tot 19
writeln(IntToStr(x) + ' ');
if(random(3) = 2) then b;
end;
procedure c;
var
x: integer;
begin
x := random(30)+20; //20 tot 29
writeln(IntToStr(x) + ' ');
end;
procedure d;
begin
writeln('I''m Gone!');
end;
function ca: boolean;
begin
c();
if(random(100) <> 1) then ab
else
begin
d();
Result := True;
end;
end;
procedure bc;
begin
b();
ca();
end;
procedure ab;
begin
a();
bc;
end;
begin
ab;
end. I made this script to test if I can make loops in the functions/procedures itself, but it doesn't work, and gives this error:
[Error] (43:28): Unknown identifier 'ab' at line 42
Why can't this work? How can I make this working, or do it differently with the same output?