But in my 2nd main function (in bold) writeln(userAns), doesn't work. It doesn't seem to recongise userAns as the list. Can anyone help please ?
I assume theres some sort of "out of scope" issue that i'm just not aware of ...
:- dynamic userAns/3.
%Questions
q('The sky is ? ',['1. brown','2. blue '], 2).
q('sugar is ? ',['1. sour','2. sweet'], 2).
main :-
q(Question,PossibleAnswers,RightAnswer),
writeln('Answer the following question using the question number or 0 to skip.'),
writeln(Question),
writeln(PossibleAnswers),
read(Ans),
result(q(Question,PossibleAnswers,RightAnswer),Ans),
fail.
main :-
writeln('Your finished, results are as follows'),
[B]writeln(userAns),[/B] <--Doesn't seem to recongise as the dynamic list.
fail.
main.
result(q(Question,PossibleAnswers,Ans),Ans):-
assertz(userAns(Question,correct,Ans)),!.
result(q(Question,PossibleAnswers,_),0):-
assertz(userAns(Question,skipped,Ans)),!.
result(q(Question,PossibleAnswers,_),_):-
assertz(userAns(Question,wrong,Ans)),!.











