Variable might not have been initialized in Delphi function

Viewed 1291

I am building this function that will return whether an ID is returned by the query or not. I am new to Delphi, and I am getting the error

Variable emailExistsId may not be initialized.

My code:

function emailExists (const APersonId: TStandardPK) : Boolean ;
var
  Email : TPhoneEmail;
  emailExistsId: TStandardPK;

begin
  Email := TPhoneEmail.Create(nil);
  try
    emailExistsId :=  Email.qrySelect.FieldByName('id').AsFloat;
  finally
    if emailExistsId <> 0  then
    Result := TRUE
    else
    Result :=False;
  end;
end;
1 Answers
Related