Search code examples
prologprolog-toplevel

Get further solutions to a query


I have

assert(user(anna)).
assert(user(tom)).

but when I query

?- user(X).

I only get

X = anna.

Shouldn't I get another line saying X = tom as well?


Solution

  • You need to type a semicolon after the first answer:

    ?- user(X).
    X = anna ;
    X = tom.