NOT condition must be boolean

Navigation:  Messages > Macro Compiler Messages > Errors >

NOT condition must be boolean

Previous pageReturn to chapter overviewNext page

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

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 makse sure that the compiler sees code the way you meant it, make sure that you make generous use of parentheses. They 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 updated on 05-Jul-2003.
Topic URL: http://www.qppstudio.net/webhelp/index.html?notconditionmustbeboolean.htm