I have a code in here

location(california, usa).
location('los angeles', california).
location(hollywood, 'los angeles').

look_on(Country,Place) :-
	location(Place,X),write(X),nl,
	look_on(Country,X),
	fail.

if i query like this one

-?look_on(Place,stamp).

the output would be:
los angeles
californai
usa
,can anyone help me how to display only the the last data which is the usa?
im really stuck in this problem for an hour.
Thanks again for the help.

-?location(california, X)

Your output looks not possible as you have no tany stamp in your DB.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.