Thursday 14 February 2019

Prolog: =:= (equal to), =\= (not equal to) operators


Prolog provides below operators to check whether two numbers are equal or not.

Operator
Example
Description
=:=
X =:= Y
Return true, if X equal to Y, else false.
=\=
X =\= Y
Return true, if X is not equal to Y, else false.

1 ?- 10 =:= 10.
true.

2 ?- 10 =:= 11.
false.

3 ?- 10 =\= 10.
false.

4 ?- 10 =\= 11.
true.



Previous                                                 Next                                                 Home

No comments:

Post a Comment