Ralph D. Wilson II wrote: > Perhaps I am missing something but I am not sure what it is you are trying > to achieve with the "OR" version. Are you wanting to SaveToFile for each > individual account or for all of the accounts when something has > changed?
The code checks for changes in Foo. If there are any changes in it, then it saves Foo to a file. To check for changes in itself, Foo checks all its accounts. Normally, finding a change in one account would be sufficient to determine that there have in fact been changes to Foo, and so a method named CheckForChanges should be able to return True immediately: Result := True; for n := 0 to Pred(Count) do begin if CheckAccount(Items[n]) then exit; Result := False; However, Wilfried's code apparently relies on certain side effects to occur while checking the accounts. That means that short-circuiting the Boolean evaluation isn't allowed, and neither is the early exit from the loop as I showed above, because he has to make sure the Foo checks all of its accounts before concluding that any of them have changed. I think Wilfried needs to use a different verb. "Check" shouldn't have side effects. -- Rob __________________________________________________ Delphi-Talk mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi-talk
