[SWIPL] How to accept a series of Yes & No responses without exiting the loop

黃耀賢 (Yau-Hsien Huang) <>
Sat Mar 13 12:19:34 CET 2010

It's hard to locate your problem and give an answer because you described
a general case. I guess you used a if-then structure that will go to end
it doesn't come up to the condition. And you ought to make two way for
two conditions, Yes or No, using if-then structure, while accepting another
atom cause the real ending condition.

f('Yes') -> !, do_yes_part().
f('No') -> !, do_no_part().
f(_). % ending condition


f(Input) ->
    'Yes' = Input -> do_yes_part();
        ( 'No' = Input -> do_no_part();

On Sat, Mar 13, 2010 at 1:43 PM, PrologStudent

> I am building a small expert system in Prolog and I am having one issue and
> that is when i am running the program and once i type a NO response the
> program automatically ignores the rest of questions within that category
> and
> jumps to the other.
> What i want it to do is continue asking all the questions in that category
> and then display the response instead of jumping to the second set of
> questions.
> Please assist.
> --
> View this message in context:
> http://old.nabble.com/How-to-accept-a-series-of-Yes---No-responses-without-exiting-the-loop-tp27885793p27885793.html
> Sent from the SWI Prolog mailing list archive at Nabble.com.
> _______________________________________________
> SWI-Prolog mailing list
> https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog

More information about the erlang-questions mailing list