I want to write a predicate which returns a solution from a factbase. When no solution exists the predicate should return “No solutions exists”. Returning a solution which exists in factbase is trivial. How to implement “No solution exists” part. I use SWI-Prolog.
Share
If you have a predicate, say
fact/1that contains all your facts, you can use an if-then-else statement as follows: