prolog arithmetic examples

In Prolog, is the similar to the assignment operator = in other languages. X is 1+2 means assign the result 1+2 to the variable X. The following are some arithmetic operations performed in the prolog console window.
[code language=”text”]
?- X is 1+2.

X = 3

?- X is 6-2.

X = 4

?- X is 2*3.

X = 6

?- X is 6/2.

X = 3

?- X is mod(9,2).

X = 1
[/code]

Search within Codexpedia

Custom Search

Search the entire web

Custom Search