SRL Archive - NOTA

Make your writeln's a little shorter...


All that is man

2009-09-10 04:21:59

Thanks to MylesMadness and R1ch for help

{*******************************************************************************
procedure WriteLnArrayEx(AOS : TStringArray; ClrDbg: boolean);
By: All that is man
Description: WriteLn's out the given strings in the array. Can clear debug.
*******************************************************************************}
procedure WriteLnArrayEx(AOS : TStringArray; ClrDbg: boolean);
var
I : Integer;

begin
if ClrDbg then
ClearDebug;
for I:= 0 to High(AOS) do
WriteLn(AOS[i]);
end;
{*******************************************************************************
procedure WritelnArray(aos: TStringArray);
By: All that is man
Description: WriteLnArrayEx with ClrDbg being false.
*******************************************************************************}
procedure WritelnArray(AOS: TStringArray);
begin
WritelnArrayEx(AOS, false);
end;

MylesMadness

2009-09-10 04:25:30

I wouldn't make it a function, just saying

All that is man

2009-09-10 04:26:13

What do you mean?

MylesMadness

2009-09-10 04:27:18

{*******************************************************************************
function WritelnArrayEx(aos: array of string; cleardbug: boolean): boolean;
By: All that is man
Description: Writeln's out the given array and possible cleardebug
*******************************************************************************}
procedure WritelnArrayEx(aos: array of string; cleardbug: boolean);
var i: integer;
begin
if cleardbug then cleardebug;
for i := 0 to high(aos) do
writeln(aos[i]);
end;

All that is man

2009-09-10 04:30:05

Right that's what I had, but thus disables

function WritelnArray(aos: array of string): boolean;
begin
result := WritelnArrayEx(aos, false);
end;
from working

MylesMadness

2009-09-10 04:35:05

From: All that is man
Right that's what I had, but thus disables

function WritelnArray(aos: array of string): boolean;
begin
result := WritelnArrayEx(aos, false);
end;
from working

procedure WritelnArray(aos: array of string);
begin
WritelnArrayEx(aos, false);
end;

All that is man

2009-09-10 04:36:21

:facepalm: thanks

Rich

2009-09-10 19:57:10

I like this. Simple but effective. Make it look a bit nicer, and voila!

{*******************************************************************************
procedure WriteLnArrayEx(AOS : TStringArray; ClrDbg: boolean);
By: All that is man
Description: WriteLn's out the given strings in the array. Can clear debug.
*******************************************************************************}
procedure WriteLnArrayEx(AOS : TStringArray; ClrDbg: boolean);
var
I : Integer;

begin
if ClrDbg then
ClearDebug;
for I:= 0 to High(AOS) do
WriteLn(AOS[I]);
end;

See how much difference it makes to the presentation? I hope something like this gets committed.

Richard.