Arrays are assignment-compatible
only if they are of the same type. Because Pascal uses name-equivalence for
types, the following code will not compile.
var
Int1: array[1..10] of Integer;
Int2: array[1..10] of Integer;
...
Int1 := Int2;
To make the assignment work,
declare the variables as
var Int1,
Int2: array[1..10] of Integer;
or
type
IntArray = array[1..10] of Integer;
var
Int1: IntArray;
Int2: IntArray;
Type compatibility and identity: Overview
数组之间是赋值兼容的当且仅当它们属于相同的类型。因为Because Pascal对类型采用名称相等(name-equivalence)的规则判定类型是否相同,所以下面的代码不能成功编译:
var
Int1: array[1..10] of Integer;
Int2: array[1..10] of Integer;
...
Int1 := Int2;
要实现此处的赋值操作,可以如下声明变量
var Int1,
Int2: array[1..10] of Integer;
或者
type
IntArray = array[1..10] of Integer;
var
Int1: IntArray;
Int2: IntArray;