2010-02-13 39 views
3
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. 

的意外輸出我希望inHands.返回是這樣的:Prolog的腳本

Left hand: 
    empty 

Right hand: 
    empty 

然而,這是我所看到的:

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. 

什麼我錯在這裏做什麼?

回答

0

原來我必須使用單引號是這樣的:

write('My text').