Dans les premières versions de Delphi, l'utilisation de la variable For après la boucle est déconseillée et sa valeur peut être indéfinie. pourtant je suis tombé sur ce bout de code dans TOleControl.GetEventMethod qui montre l'inverse .

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
   for Index := 0 to FControlData^.EventCount-1 do
  begin
    if DispID = PID^ then
      break;
    Inc(PID);
  end;
 
  if Index = FControlData^.EventCount then
  begin
    Method.Code := nil;
    Method.Data := nil;
    Exit;
  end;
..