Constants are used to name specific objects (or)
relationships.
There are two kinds of constants in Prolog.
a.
Symbolic constants
b.
Numbers
Symbolic constants
Symbolic constants starts with lowercase alphabets.
For example, all the names that we are used in facts are
constants.
male(krishna).
male(rama).
male(hari).
In the above facts, Krishna, rama and hari are contants.
Apart from these special symbols ?- (Used to ask
question), :-(Used to define a rule) are also constants in Prolog.
Numbers
A constant can be numeric like 1, 3.14, 143, 3e4 etc.,
No comments:
Post a Comment