function IsAOrB(const p_Id: string): boolean;
begin
if ((p_Id = 'A') or (p_Id = 'B')) then begin
Result := true;
Exit;
end;
Result := false;
end;
Result := ((p_Id = 'A') or (p_Id = 'B'));
That would have been enough. But this also features Exit and an asymmetrical if.