if Boolean类型的函数 then 这不就是调用那个函数的么?delphi2007没用过,d7中,重新编译一下工程看能不能用
boolean类型的函数返回值就是一个布尔值(True or False),所以可以是 if ... then 这样的型式调用函数。
if Boolean类型的函数 then 这时就先调用了这个函数,再用它的返回值作用到if then语句中。 没用过2007
function xx(value:integer):boolean; begin result:=value>0; end;下面会先调用xx函数,然后判断返回值;和b:=xx(k); if b then结果一样的 k:=100; if xx(k) then showmessage('k>0') else showmessage('k<=0');
function IsFool(APerson: TPeople): Boolean; begin Result := True; end;
这不就是调用那个函数的么?delphi2007没用过,d7中,重新编译一下工程看能不能用
这时就先调用了这个函数,再用它的返回值作用到if then语句中。
没用过2007
begin
result:=value>0;
end;下面会先调用xx函数,然后判断返回值;和b:=xx(k); if b then结果一样的
k:=100;
if xx(k) then
showmessage('k>0')
else
showmessage('k<=0');
begin
Result := True;
end;