language · keyword ·
and
Short-circuit boolean conjunction
Put cheap or safety-critical guards first so later expressions run only inside their valid domain.
andStatus: stable
Short circuit
Put cheap or safety-critical guards first so later expressions run only inside their valid domain.
cpu · complete-program · type checked
list of int empty = []
bool andResult = false and empty[0] == 1
bool orResult = true or empty[0] == 1
if !andResult and orResult
{
Console.Log("short-circuit-ok")
}
else
{
Console.Log("short-circuit-bad")
}
project.mech
package = "tests.compiler.fastContract.shortCircuit"
Notes and source
The canonical unary spelling is !, not the editor grammar's historical not token.
There are no truthy or falsy conversions.
yeho/parser_expressions.cpp parseOr/parseAnd/parseUnary; conformance control.boolean-conditions