What’s wrong with my code? I’m getting this error:
[dcc32 Error] Unit6.pas(83): E2012 Type of expression must be BOOLEAN
function checkver(): boolean;
begin
//some code here
end;
function refresh(): boolean;
begin
//some code here
end;
procedure TForm6.FormCreate(Sender: TObject);
begin
if checkver() then
if refresh() then //Error is HERE!!
//some code here
end;
TControl(which your form class descends from) has aRefreshmethod of its own, and it doesn’t return a Boolean. The scope of that method is closer than the scope of the unit-level method by the same name because you’re writing code in a method of that class, so the compiler binds with theRefreshmethod, not therefreshfunction.Call
<unitname>.refreshto get the unit-level function instead of the method.