Pick
and choose, the first option is faster, no unnecessary
assignments.
lets
face it, exit or break are both exit controls. In a small controled and
encapsulated procedure such as this the exit method I feel is more practical and
easier to understand. Go with what feels comfortable. there is nothing wrong
with either option
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Stephen Bertram
Sent: Thursday, 31 October 2002 5:27 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Style question - your votes pleaseWe're having a quiet (NOT) discussion about the PCness of the following code:function FindFirstMatch (List: TItemList; Status: TItemStatus): Integer;beginfor Result := 0 to List.Count - 1 doif List[Result].Status = Status thenExit;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:function FindFirstMatch (List: TItemList; Status: TItemStatus): Integer;vari: Integer;beginResult := -1;for i := 0 to List.Count - 1 doif List[Result].Status = Status thenbeginResult:= i;Break;end;end;Which is preferable or what is a tidier method?Stephen