Search code examples
clips

How to OR and AND operator in CLIPS?


I need to OR and AND operator while expression evaluation, but when I use it to CLIPSDOS it give wrong result.

CLIPS (6.31 6/12/19)
CLIPS> ( and 0 1 )
TRUE
CLIPS>

I expect the output FALSE but it give TRUE What could be wrong?


Solution

  • In C, the integer 0 is false and any other integer is true.

    In CLIPS, the symbol FALSE is false and any other value is true.

             CLIPS (6.31 6/12/19)
    CLIPS> (and 0 1)
    TRUE
    CLIPS> (and 1 2)
    TRUE
    CLIPS> (and FALSE TRUE)
    FALSE
    CLIPS>