just wanna ask if we could shorten the code below by using sets or arrays
i've tried both but didnt work ><
Code: Select all
type
TForm1 = class(TForm)
Image1:TImage;
Image2:TImage;
Image3:TImage;
Image4:TImage;
Image5:TImage;
procedure Button1Click(Sender: TObject);
begin
Image1.Visible := True;
Image2.Visible:= True;
Image3.Visible:= True;
Image4.Visible:= True;
Image5.Visible:= True;
end
end;
end.
Code: Select all
type
TForm1 = class(TForm)
Image1:TImage;
Image2:TImage;
Image3:TImage;
Image4:TImage;
Image5:TImage;
procedure Button1Click(Sender: TObject);
var i : Array of Integer ;
begin
For i 1 to 5 do
Image(i).Visible := True;
end
end;
end.

im currently writing a program with 1300 line on codes
and this would definitely shorten it to around 700 lines