I am trying to write a predicate, likes/2
, in a manner where it runs like the following:
?- likes(A,alan).
A = lindsay ;
A = chloe ;
A = cheyanne ;
A = britney ;
Here is how I am tackling the problem:
% Define your facts:
combo(lindsay,alan).
combo(chloe,alan).
combo(cheyanne,alan).
combo(britney,alan).
% Define your predicate:
likes(A,B) :- combo(A,B); combo(B,A).
Now, the issue that I am facing is that while my program functions as it is supposed to, for the most part, it prints out a false at the end and I don't understand why. Here is the full output:
?- likes(A,alan).
A = lindsay ;
A = chloe ;
A = cheyanne ;
A = britney ;
false.