OG_
OG_

Reputation: 59

Variable in Prolog

I have this code in Prolog... I use swi-prolog for ubuntu.

follows(ilias, petros).
follows(petros,ilias).
follows(petros, demos).
follows(demos,petros).

and I ask this 2 queries:

?- follows(petros,X),follows(X,petros).
X = ilias ;
X = demos ;
false.

?- follows(petros,makis),follows(makis,petros).
false.

and getting these two different outcomes. My trouble is that from what I know makis is a variable just like X. but prolog doesn't respond the same way and I can't understand why is that.

Thank you in advance for any answer!!!

Upvotes: 1

Views: 65

Answers (1)

Markandeya
Markandeya

Reputation: 537

A variable in prolog is a string of upper-case letters, lower-case letters, digits and underscore characters that starts either with an upper-case letter or with an underscore.

So, you may use Makis instead of makis.

Upvotes: 2

Related Questions