learning_prolog/simple_exercises/sum.pl

5 lines
138 B
Perl
Raw Normal View History

2023-10-28 06:18:41 +00:00
% 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.