causes that one goal implicates alternative goals.
If IfGoal succeeds then ThenGoal will be executed.
If IfGoal fails ElseGoal will be executed.
'->'/2 succeeds if either ThenGoal or ElseGoal succeeds.
There are two significant differences to ','/2:
';'/2 is a predefined infix-operator with priority 1100 which is right-associative,
'->'/2 is a predefined infix-operator with priority 1050 which is right-associative (see also current_op/3).
IfGoal goal ThenGoal goal ElseGoal goal
| Day=sunny -> Weather=sunshine; Weather=raining. | Succeeds. |
| X=b, X=a -> write(a); write(b). | Succeeds with substitution X <- b and outputs to the current outputstream 'b'. |
This predicate is part of the ISO-Prolog Standard.