The following code compiles, runs and loops forever.
I’d expect an error at compilation time.
`namespace ForVar;
interface
uses
System.Linq;
type
Program = class
public
class method Main(args: array of String): Int32;
end;
implementation
class method Program.Main(args: array of String): Int32;
var i: Integer;
begin
for i:= 3 downto 1 do begin
for i:= 1 to 3 do begin
writeLn(i);
end;
end;
end;
With only one variable “i” declared, I’m surprised that that syntax should even be allowed. Seems ambiguous to me. Unless the loop doesn’t really use the variable that is declared.