Smart pascal source code
{ main.pas }
Begin
// -----> CASE I <-------
const a : array [1..4] of Integer = [11, 22, 33, 44];
var i : Integer;
WriteLn(a[1]);
WriteLn(a[2]);
WriteLn(a[3]);
WriteLn(a[4]);
for i:=Low(a) to High(a) do
WriteLn(a[i]);
{ <<<<<<<<<<<< CONSOLE OUTPUTS >>>>>>>>>>>>>>>>>>>
11 22 33 44
11
22
33
44
}
// -----> CASE II <-------
const ac : array [1..4] of Integer = [11, 22, 33, 44];
var aa := ac;
WriteLn(aa[1]);
WriteLn(aa[2]);
WriteLn(aa[3]);
WriteLn(aa[4]);
for i:=Low(aa) to High(aa) do
WriteLn(aa[i]);
{ <<<<<<<<<<<< CONSOLE OUTPUTS >>>>>>>>>>>>>>>>>>>
11 22 33 44
11
22
33
44
}
// -----> CASE III <-------
type TEnum = (en1, en2, en3);
const ace : array [TEnum] of String = ['one', 'two', 'three'];
const ac2 = ace;
var j : TEnum;
for j in TEnum do
WriteLn(ace[j]);
for j in TEnum do
WriteLn(ac2[j]);
{ <<<<<<<<<<<< CONSOLE OUTPUTS >>>>>>>>>>>>>>>>>>>
one
two
three
one
two
three
}
// -----> CASE VI <-------
type TEnum2 = (en1, en2, en3);
type TEnumArray = array [TEnum2] of string;
const acb : TEnumArray = ('one', 'two', 'three');
const ac21 : TEnumArray = acb;
var k : TEnum2;
for k in TEnum2 do
WriteLn(acb[k]);
for k in TEnum2 do
WriteLn(ac21[k]);
{ <<<<<<<<<<<< CONSOLE OUTPUTS >>>>>>>>>>>>>>>>>>>
one
two
three
one
two
three
}
// -----> CASE V <-------
const
X: array [0..1, 0..2] of Integer = [[1, 2, 3], [4, 5, 6]];
WriteLn(X[0,0]);
for var w := Low(X) to High(X) do
for var z := Low(X[w]) to High(X[w]) do
WriteLn(IntToStr(w)+', '+IntToStr(z)+' : '+IntToStr(X[w, z]));
{ <<<<<<<<<<<< CONSOLE OUTPUTS >>>>>>>>>>>>>>>>>>>
1
0, 0 : 1
0, 1 : 2
0, 2 : 3
1, 0 : 4
1, 1 : 5
1, 2 : 6
}
// -----> CASE VI <-------
type
TDayTable = array[1..12] of Integer;
const
{ True=Leapyear }
cMonthDays: array [boolean] of TDayTable =
((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));
for var m := 1 to 12 do
WriteLn(cMonthDays[False, m].ToString+' vs '+cMonthDays[True][m].ToString);
{ <<<<<<<<<<<< CONSOLE OUTPUTS >>>>>>>>>>>>>>>>>>>
31 vs 31
28 vs 29
31 vs 31
30 vs 30
31 vs 31
30 vs 30
31 vs 31
31 vs 31
30 vs 30
31 vs 31
30 vs 30
31 vs 31
}
var i = 0;
var aa = [0,0,0,0],
j = 0;
var k = 0;
var w = 0;
var z = 0;
var m = 0;
/// TEnum2 enumeration
/// [line: 139, column: 6, file: uMain]
var TEnum2 = [ "en1", "en2", "en3" ];
/// TEnum enumeration
/// [line: 116, column: 6, file: uMain]
var TEnum = [ "en1", "en2", "en3" ];
var X = [[1,2,3],[4,5,6]],
cMonthDays = [[31,28,31,30,31,30,31,31,30,31,30,31],[31,29,31,30,31,30,31,31,30,31,30,31]],
ace = ["one","two","three"],
acb = ["one","two","three"],
ac21 = ["one","two","three"],
ac2 = ["one","two","three"],
ac = [11,22,33,44],
a = [11,22,33,44];
WriteLn(11);
WriteLn(22);
WriteLn(33);
WriteLn(44);
for(i=1;i<=4;i++) {
WriteLn(a[(i)-1]);
}
aa = ac;
WriteLn(aa[(1)-1]);
WriteLn(aa[(2)-1]);
WriteLn(aa[(3)-1]);
WriteLn(aa[(4)-1]);
for(i=1;i<=4;i++) {
WriteLn(aa[(i)-1]);
}
for(j=0;j<=2;j++) {
WriteLn(ace[j]);
}
for(j=0;j<=2;j++) {
WriteLn(ac2[j]);
}
for(k=0;k<=2;k++) {
WriteLn(acb[k]);
}
for(k=0;k<=2;k++) {
WriteLn(ac21[k]);
}
WriteLn(1);
for(w=0;w<=1;w++) {
for(z=0;z<=2;z++) {
WriteLn((w.toString()+", "+z.toString()+" : "+(X[w][z]).toString()));
}
}
for(m=1;m<=12;m++) {
WriteLn(((cMonthDays[false?1:0][(m)-1]).toString()+" vs "+(cMonthDays[true?1:0][(m)-1]).toString()));
}