non
Translation status: 繁體中文 reader-locale proof. Code fences render through the zh-Hant pipeline; prose is canonical Latin.
Negates a boolean expression.
Aliases: !
Syntax: non <expression>
Category#
logic
Related#
Examples#
radix/corpus/non/non.fab (canonical · keyword)#
Negates a boolean expression.
# =============================================================================
# non — Negates a boolean expression.
# =============================================================================
#
# What this teaches:
# • the `non` keyword — unary boolean negation (equivalent to `!`)
#
# Common mistakes:
# • Confusing non (logical negation) with ≠ (inequality comparison) — non negates a boolean, ≠ compares two values.
#
# See also: verum, falsum
# =============================================================================
# non — logical not
#
# GRAMMAR:
# unaryExpr :← 'non' expr
#
# EXPECTED OUTPUT:
# Scalar stdout smoke (see body).
#
main {
const _ flag ← false
const _ negated ← not flag
print negated
}
test "non negates falsum" {
const _ flag ← false
const _ negated ← not flag
assert negated
}
test "non negates verum" {
const _ flag ← true
const _ negated ← not flag
assert negated ≡ false
}
test "non applied twice returns the original" {
const _ flag ← false
const _ negated ← not flag
const _ bis ← not negated
assert bis ≡ false
}Expected output:
verum