Since it is a for loop, High(a) will only be evaluated once. If it would be evaluated every loop, you could affect the number of loops by changing the dimensions or size of a.
Besides that. The Delphi compiler is incredibly smart.
So since comparing a number with 0 is slightly faster than...
I would like to say I prefer MikeEd's method, but I don't. This code won't compile since btn1 isn't created at designtime yet.
You also don't have to typecast the component unless you need some specific properties of the component:
procedure HandleMyEvents(Sender: TObject);
begin
if not...
It's best to build a recursive function. Below I demonstrate a function that searches a specified folder and all sub folders for mp3 files. It's recursive, hence, it calls itself to process subfolders.
And no, I'm not using highlights in every post ;-)
You can call this function like this...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.