I have been recommended to use the second, try-except variant, but I would also like to know what others think: which procedure of the two below (if any) is more time-efficient?
procedure LoadImage(img: TImage; filename: string);
begin
if fileexists(filename) then
img.Picture.Loadfromfile(filename)
else
img.Picture.Loadfromfile('default.jpg')
end;
or
procedure LoadImage(img: TImage; filename: string);
begin
try
img.Picture.Loadfromfile(filename)
except
img.Picture.Loadfromfile('default.jpg')
end
end;