learning_prolog/simple_exercises/sum.pl

5 lines
138 B
Prolog

% Define the rule to sum 2 numbers
sum(X, Y, Z) :- Z is X + Y.
% Define the rule to know if a number is even.
is_even(X) :- 0 is X mod 2.