forked from pascalabcnet/pascalabcnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharrayinitializer1.pas
58 lines (50 loc) · 1.3 KB
/
arrayinitializer1.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
procedure Test;
var s : string := 'abc';
arr1 : array of char := (s[1],s[2],s[3]);
arr2 : array[1..3] of char := (s[1],s[2],s[3]);
var s2 := '123';
var arr3 : array of char := (s2[1],s2[2],s2[3]);
var arr4 : array[1..3] of char := (s2[1],s2[2],s2[3]);
begin
assert(arr1[0]='a');
assert(arr2[2]='b');
assert(arr3[0]='1');
assert(arr4[2]='2');
end;
{procedure Test2;
var s : string := 'abc';
arr1 : array of char := (s[1],s[2],s[3]);
arr2 : array[1..3] of char := (s[1],s[2],s[3]);
procedure Nested;
begin
assert(arr1[0]='a');
assert(arr2[2]='b');
//var s2 := '123';
var arr3 : array of char := (s[1],s[2],s[3]);
var arr4 : array[1..3] of char := (s[1],s[2],s[3]);
assert(arr3[0]='1');
assert(arr4[2]='2');
end;
begin
assert(arr1[0]='a');
assert(arr2[2]='b');
var s2 := '123';
var arr3 : array of char := (s2[1],s2[2],s2[3]);
var arr4 : array[1..3] of char := (s2[1],s2[2],s2[3]);
assert(arr3[0]='1');
assert(arr4[2]='2');
end;}
var s : string := 'abc';
arr1 : array of char := (s[1],s[2],s[3]);
arr2 : array[1..3] of char := (s[1],s[2],s[3]);
var s2 := '123';
var arr3 : array of char := (s2[1],s2[2],s2[3]);
var arr4 : array[1..3] of char := (s2[1],s2[2],s2[3]);
begin
assert(arr1[0]='a');
assert(arr2[2]='b');
assert(arr3[0]='1');
assert(arr4[2]='2');
Test;
//Test2;
end.