Sandeep

Since you have not assigned a value to l it will most likely evaluate as
False and GetResult will not be called (Delphi evaluates left to right).

Also PLEASE do not use "l" as a variable name !!!
 
If you want GetResult to always run rearrange the if statement to:

  if GetResult and MyLocalBoolean then
    ( Do something );

Stephen


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Sandeep Chandra
Sent: Tuesday, 2 November 2004 11:40 a.m.
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] Function evaluation in IF..THEN..

Is it ok to have following if..then statement

procedure Test;
var
  l : Boolean;

  function GetResult : boolean;
  begin
    { Do something }
    Result := True; 
  end;

begin
  if (l) and GetResult then
    { Do Something }
end;

Is there any chance that the compiler might not call
the function?

Regards

Sandeep


                
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to