not
, and
, and or
.
Now try:
>: not true;Hope replies:
>> false : bool
and now try:
>: not false;Hope replies:
>> true : bool
The operator not
is a unary boolean operator since it is applied to a single boolean expression.
Try:
>: not (not false);Hope replies:
>> false : boolWhy is this? In order to work out
not (not false)
hope first evaluates the inner
(not false)
to give true
so the whole expression reduces to
not (true)
which evaluates to false
.
In shorthand we can write:
not (not false)
not (true)
false
.
Similarly:
not (not (1<2))
not (not (true))
not (false)
true
.