Evaluating expressions
An expression is built from variables, constants and operators (+, -, *, /, %, …).
Once its variables have values it denotes a value; by itself it is neither true nor false.
In even(N) :- num(N), N % 2 = 0, the expression N % 2:
N | N % 2 |
|---|---|
| 4 | 0 |
| 5 | 1 |
| 6 | 0 |
Only inside a comparison,
N % 2 = 0, does an expression take part in a true/false test.