Javatpoint Logo
Javatpoint Logo

Data Objects in Prolog

In Prolog, data objects are also known as terms. In Prolog, the example of terms is bulldog, dog(rottweiler), A, and cat(A).

Terms have several different types, which are explained as follows:

1. Numbers

In Prolog, all versions allow the use of integers. Any sequence of numbers from 0 to 9 is written as numbers. The numbers are preceded by + or - sign.

For example,

The use of numbers with decimal points is allowed by most versions of Prolog. Just like the integer, they are written. It contains a single decimal point. But this decimal point cannot exist before an optional plus(+) or minus(-) sign.

For example:

2. Atoms

Atoms do not have any numerical value. Atoms are like the constants. The atoms can be written in three different ways.

a. Any sequence of upper case or lower case letters, underscores, numerals, starting with a lower case letter. For example,

b. In single quotes, any sequence of characters can be enclosed. It includes lower case letters and spaces. For example,

c. Any sequence of one or more characters includes = @ > < # & + - * /. For example,

3. Variable

A variable is a name that is used to stand for a term. The variable name can be any sequence of one or more upper case letters or lower case letters, underscore, and numerals. It can begin with an underscore or lower case letters.

For example:

Next TopicProlog clauses

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA