Search code examples
prologprolog-toplevel

Prolog not giving correct answer


I am learning Prolog. I wrote some simple facts. But it seems that Prolog is not giving me right answers. Please help me understand what I am doing wrong here.

facts - weather.pl

weather(pheonix,summer,hot).   
weather(pheonix,winter,warm).  
weather(la,summer,warm).

When I run this in swi-prolog as follows

?- weather(City,_,warm).
City = pheonix .

Result is only shown as pheonix. But la is also warm. Why is it not given as an answer?


Solution

  • Typically, after first answer is written, you can type some key, usually ";", to backtrack and receive another answer.