This compiler error will occur the not operator is placed in front of an expression that is not boolean.
An obvious example is:
var
bOddPage
begin
bOddPage = not n_OutputPage
end
But this error may occur in a less obvious context, such as:
var
bOddPage
begin
bOddPage = not n_OutputPage div 2 == 0 // no !
end
In this second example the problem is the precedence of evaluation of different expressions. The compiler tries to evaluate not n_OutputPage before looking at the rest of the expression. To make sure that the compiler sees code the way you meant it, make sure that you make use of parentheses, as in the modified example below.
var
bOddPage
begin
bOddPage = not (n_OutputPage div 2 == 0) // OK
end
The additional parentheses do not slow down execution of your macros and help make the code unambiguous to the compiler ... and to yourself if you ever need to re-read your macro a year from now.
Topic 109025, last updated on 18-Apr-2020