3 ms·
Thank you! I also tried {$R+} type R1 = 1..3; R2 = 1..4; var a: R1; b: R2; begin b := 4; a := b; Wri
by dannymi 3y ago
Thank you!
I also tried
{$R+}
type
R1 = 1..3;
R2 = 1..4;
var
a: R1;
b: R2;
begin
b := 4;
a := b;
Writeln(a)
end.
... and that only gives me a runtime error. So maybe those types count as equal anyway?
- badsectoracula 3y agoThe types themselves count as assignable since the values can be compatible and unless the compiler can tell statically a value is out of range it wont complain at compile time (but will at runtime if range checking is enabled). However using the ranges for arrays is not compatible, if you have a A: array [R1] of Double and a B: array [R2] of Double you can't assign one to the other.