program Project1;
const
SIndent = ' ->';
var
LText: String;
LArrayText1, LArrayText2: array [0..1] of String;
i: Integer;
begin
// using the array of strings given in the loop (for..in)
WriteLn('Using the array of strings given in the loop (for..in):');
WriteLn;
WriteLn('As Pascal string (numbers, text):');
for LText in ['1234', 'acbde'] do
WriteLn(SIndent + LText);
WriteLn;
WriteLn('As Pascal string (text, numbers):');
for LText in ['acbde', '1234'] do
WriteLn(SIndent + LText);
WriteLn;
WriteLn('As PChar (numbers, text):');
for LText in ['1234', 'acbde'] do
WriteLn(SIndent + PChar(LText));
WriteLn;
WriteLn('As PChar (text, numbers):');
for LText in ['acbde', '1234'] do
WriteLn(SIndent + PChar(LText));
// using the array of strings defined earlier (for..to..do)
WriteLn;
WriteLn('========');
WriteLn;
WriteLn('Using the array of strings defined earlier (for..to..do):');
WriteLn;
LArrayText1[0] := '1234';
LArrayText1[1] := 'acbde';
LArrayText2[0] := 'acbde';
LArrayText2[1] := '1234';
WriteLn('As Pascal string (numbers, text):');
for i := 0 to 1 do
WriteLn(SIndent + LArrayText1[i]);
WriteLn;
WriteLn('As Pascal string (text, numbers):');
for i := 0 to 1 do
WriteLn(SIndent + LArrayText2[i]);
WriteLn;
WriteLn('As PChar (numbers, text):');
for i := 0 to 1 do
WriteLn(SIndent + PChar(LArrayText1[i]));
WriteLn;
WriteLn('As PChar (text, numbers):');
for i := 0 to 1 do
WriteLn(SIndent + PChar(LArrayText2[i]));
// prevent the console window from closing
ReadLn;
end.