Let Prolog search for answers.
Use → to advance · Esc for slide overview
likes(ada, tea).
likes(ben, coffee).
likes(ada, music).
?- likes(ada, What).Variables begin with an uppercase letter or underscore.
?- likes(ada, What).
What = tea ;
What = music.The semicolon is typically entered by the user to ask for another solution.
?- likes(Who, tea),
likes(Who, music).
Who = ada.One variable must refer to the same value in both goals.
With the facts shown earlier, what does this query ask?
?- likes(Person, coffee).It asks for each Person who likes coffee.
Write facts. Define relationships. Ask questions.
More chapters coming soon