Unexpected output of a Prolog script
leftHand(empty).
rightHand(empty).
inHands :-
write("Left hand:"),
nl,
leftHand(X),
tab(2),
write(X),
nl,
nl,
write("Right开发者_开发问答 hand:"),
rightHand(Y),
tab(2),
write(Y),
nl.
I expect inHands.
to return something like this:
Left hand:
empty
Right hand:
empty
However, this is what I saw:
24 ?- inHands.
[76, 101, 102, 116, 32, 104, 97, 110, 100, 58]
empty
[82, 105, 103, 104, 116, 32, 104, 97, 110, 100, 58] empty
true.
What am I doing wrong here?
Turns out I have to use single quotes like this:
write('My text').
精彩评论