非
Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans pack; supporting prose may still be English.
Negates a boolean expression.
Aliases: !
Syntax: 非 <expression>
Category#
logic
Related#
Examples#
radix/corpus/non/non.fab (canonical · keyword)#
Negates a boolean expression.
test "non negates falsum" {
const bool flag ← false
const bool negated ← not flag
assert negated
}
test "non negates verum" {
const bool flag ← true
const bool negated ← not flag
assert negated ≡ false
}
test "non applied twice returns the original" {
const bool flag ← false
const bool negated ← not flag
const bool bis ← not negated
assert bis ≡ false
}
# =============================================================================
# 非 — Negates a boolean expression.
# =============================================================================
#
# What this teaches:
# • the `非` keyword — unary boolean negation (equivalent to `!`)
#
# Common mistakes:
# • Confusing 非 (logical negation) with ≠ (inequality comparison) — 非 negates a boolean, ≠ compares two values.
#
# See also: 真, 假
# =============================================================================
# 非 — logical not
#
# GRAMMAR:
# unaryExpr :← '非' expr
#
# EXPECTED OUTPUT:
# Scalar stdout smoke (see body).
#
main {
const bool flag ← false
const bool negated ← not flag
print negated
}Expected output:
verum