Prolog another simple question
How do i read in char type by user开发者_如何转开发s if they are a- , b+ , o+ ? I don't seem to have problem reading in char like a , b , c or d. i am using read(X) . Can someone help me out with this ? Thanks in advance.
I managed to solve the problem using read_string() . :)
As I remember read/1 reads the term. If you want to read characters you may consider get_char/1 or something like that
?- get_char(X),get_char(Y).
|: a-
X = a,
Y = (-).
精彩评论