When an expression is used as a condition, it must be of the Boolean type to produce this error message. This is true for the if, while, and repeat statements’ controlling expressions, as well as the expression that controls a conditional breakpoint.
program Produce; var P: Pointer; begin if P then Writeln('P <> nil'); end.
A pointer variable was used as the condition of an if statement in this case by a C++ writer.
program Solve; var P: Pointer; begin if P <> nil then Writeln('P <> nil'); end.
In this scenario, you must be more explicit in Delphi.
Leave a Reply