Stephen asked:
function FindFirstMatch (List: TItemList; Status: TItemStatus): Integer;
begin
  for Result := 0 to List.Count - 1 do
    if List[Result].Status = Status then
      Exit;
  Result := -1;
end;
 
The main objection is the use of Exit, but the only simple way I can see to write around that is to add a local variable:
What's wrong with Exit? I use this idiom all the time - it's equivalent to the C return statement and very handy.
 
TTFN,
  Paul.

Reply via email to