File: arrays.pas

package info (click to toggle)
lazarus 2.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 214,460 kB
  • sloc: pascal: 1,862,622; xml: 265,709; cpp: 56,595; sh: 3,008; java: 609; makefile: 535; perl: 297; sql: 222; ansic: 137
file content (31 lines) | stat: -rw-r--r-- 735 bytes parent folder | download | duplicates (8)
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
program arrays;

{$mode objfpc}{$H+}

type
  TFoo=record
    a:byte;
    b:word;
  end;
  TT1=array[1..5,1..5] of TFoo;
  TT2=array[1..5] of array[1..5] of TFoo;
  TT3=array[1..5,1..5] of byte;
  TT4=array[1..5] of array[1..5] of byte;

var
  t1:TT1;
  t2:TT2;
  t3:TT3;
  t4:TT4;

begin
  writeln(t1[1,1].a);//Works
  writeln(t1[1][1].);//Error: default property not found
  writeln(t2[1,1].);//Error: illegal qualifier . found
  writeln(t2[1][1].a);//Works
  writeln(t3[1,1].);//Error: illegal qualifier . found (as expected)
  writeln(t3[1][1].);//EAccessViolation: Access violation (!)
  writeln(t4[1,1].);//Error: illegal qualifier . found (as expected)
  writeln(t4[1][1].);//Error: illegal qualifier . found (as expected)
end.