Hello, his is my first(, or 2nd, idk) function:
SCAR Code:
function Count(Ending : Integer): Boolean;
var Starting : Integer;
begin
repeat
Starting := Starting + 1;
Writeln(''+IntToStr(Starting)+' msec');
until(Starting = Ending);
ClearDebug;
if (Rep = True) then
begin
Writeln('Counted to '+IntToStr(Ending * HowMuch)+' msec / ~'+IntToStr(Ending * HowMuch / 1000)+' sec[s]');
end else
begin
Writeln('Counted to '+IntToStr(Ending)+' msec / ~'+IntToStr(Ending / 1000)+' sec[s]');
end;
end;
And here's how it can be used:
SCAR Code:
program New;
var T : Integer;
const
Rep = True; //Repeat?
HowMuch = 5; //How much times to repeat?
Msecs = 1500; //How much millisecs to count? (1000 = 1sec)
function Count(Ending : Integer): Boolean;
var Starting : Integer;
begin
repeat
Starting := Starting + 1;
Writeln(''+IntToStr(Starting)+' msec');
until(Starting = Ending);
ClearDebug;
if (Rep = True) then
begin
Writeln('Counted to '+IntToStr(Ending * HowMuch)+' msec / ~'+IntToStr(Ending * HowMuch / 1000)+' sec[s]');
end else
begin
Writeln('Counted to '+IntToStr(Ending)+' msec / ~'+IntToStr(Ending / 1000)+' sec[s]');
end;
end;
begin
if (Rep = True) then
begin
repeat
T := T + 1;
Count(Msecs);
until(T = HowMuch);
end else
Count(Msecs);
end.