Navigation
Synopsis The equivalence operator on Boolean values.
Syntax Exp1 <==> Exp2
Types
Exp1 Exp2 Exp1 <==> Exp2
bool bool bool
Description The equivalence operator on Boolean values defined as follows:
Exp1 Exp2 Exp1 <==> Exp2
true true true
true false false
false true false
false false true
Boolean operators have short circuit semantics: only those operands are evaluated that are needed to compute the result. However, in the case of the <==> operator both operands have to be evaluated to determine the result.

Note that the <==> operator backtracks over its arguments until it finds an evaluation that is true, unless there is none. Variable bindings that are the effect of matching operators in its arguments are not visible outside the scope of the <==>.
Examples
rascal>import IO;
ok
rascal>false <==> false;
bool: true
rascal>false <==> true;
bool: false
We should add a more meaningful example of backtracking over <==> than this old one: (i <- [1,2]) <==> (j <- [1,2,3]); for ((i <- [1,2]) <==> (j <- [1,2,3])) println("true!"); (i <- [1,2] && (i % 2 == 0)) <==> (j <- [1,2,3] && (j % 3 == 0)) for ((i <- [1,2] && (i % 2 == 0)) <==> (j <- [1,2,3] && (j % 3 == 0))) println("true!");
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.