'I have an error on this prolog code line 10 word first I cant figure it out what's my mistake plz help me
go:-
university(area),
write('Shall we start?: '),
write(area),
nl,
undo.
university(csandse) :- csandse, !.
csandse :-
verify(labs),
verify(classrooms),
verify(Teachers Staffroom),
verify(Department's faculty office).
ask(Question):-
write('which area of department you want to visit?: '),
write(Question),
write('? '),
read(Response),
nl,
( (Response == yes; Response == y)
assert(yes(Question));
assert(no(Question)), fail).
:- dynamic yes/1, no/1.
verify(S) :-
(yes(S)
true ;
(no(S)
fail ;
ask(S))).
Solution 1:[1]
I've edited the question to add code formatting; we can see the colour changes midway through Department's faculty office:
because the apostrophe is throwing it off. The same colour change happens in SWISH. As @brebs comments, things starting with a capital are Variables and must be wrapped in single quotes to be atoms. Ones with quotes used as apostrophes need to have the apostrophe escaped with a backslash:
verify('Department\'s faculty office')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TessellatingHeckler |

