+body_term -> +body_term [ISO]

The if-then operator is a predefined right-associative operator of precedence 1050. If the left operand succeeds the right operand is executed, else not. If the left operand succeeds the choice points are cut. The expression left -> right is equal to: call(left), !, right.
Because the conjunction operator (the AND operator) binds stronger than the disjunction operator (the OR operator) it it advisable to use parentheses for the entire if-then-else expression.

see also: always/2 call/1 catch/2 catch/3 fail/0 halt/0 halt/1 if-then-else/2 once/1 repeat/0 throw/1 true/0

Examples  
((X = 0) -> (Y = 1)). succeeds with X=0 and Y=1
X=1, ((X = 0) -> (Y = 1)). fails

 

 

info@trinc-prolog.com