next up previous
Next: Example Up: prolog Previous: Disjunction

Comparison Operators

X = Y  % X and Y are unifiable
T1 == T2  % True if T1 and T2 are identical (names of variables are the same)
T1 \== T2  % True if T1 and T2 are not identical
E1 =:= E2  % True if values of expressions E1 and E2 are equal
E1 =\= E2  % True if values of expressions E1 and E2 are not equal
E1 < E2  % True if numeric value of E1 is < numeric value of E2
Similar for operators =<, >, and >=

positive(N) :- N>0.

non_zero(N) :- N<0 ; N>0.