The listing of Nani Search entered at this point Prolog will respond with a 'no' if no match was found. That is, the kitchen is not located in the apple. However, here is the problem with the one-way doors, which we still haven't fixed. It is mentioned again to stress the importance of the order of the arguments. The logical variables replace one or more of the arguments in the goal.
Logical variables add a new dimension to unification.
As before, the predicate names and arity must be the same for unification to succeed. However, when the corresponding arguments are compared, a variable will successfully match any term. After successful unification, the logical variable takes on the value of the term it was matched with. This is called binding the variable. When a goal with a variable successfully unifies with a fact in the database, Prolog returns the value of the newly bound variable.