On 28/11/12 10:15, Erwin van den Bosch wrote:
procedure TForm1.Button1Click(Sender: TObject);
var
   iLastError: integer;
begin
   iLastError:=10053;
   if iLastError in [10053, 10054] then Label1.Caption:='Yes, it works!'
                                   else Label1.Caption:='No, it doesn''t
work!';
   // Output : No, it doesn''t work!
end;

You may be thinking of how "in" is used in a for..in..do loop like this

procedure TForm1.Button1Click(Sender: TObject);
var
   iLastError, j: integer;
   intArray: array[0..1] of integer = (10053,10054);
begin
   iLastError:=10053;
   for j in intArray do
    if j=iLastError
     then begin
           Label1.Caption:='iLastError present';
           Break;
          end
    else label1.Caption:= 'iLastError not found';
end;


--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to