unarius
Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.
Unary negation, logical not, sign comparisons, and optional presence tests.
Syntax: -<expr> | not <expr> | <expr> > 0 | <expr> is none
Category#
operators
Related#
Examples#
radix/corpus/unarius/unarius.fab (canonical · operator-group)#
Unary negation, logical not, sign comparisons, and optional presence tests.
# =============================================================================
# unarius — Unary negation, logical not, sign comparisons, and optional presence tests.
# =============================================================================
#
# What this teaches:
# • Unary operators — negation (`-`), logical not (`not`), and sign comparisons
# • Null checks — `est none` and `is not none` for optional presence testing
#
# Common mistakes:
# • confusing not (logical not, prefix) with - (numeric negation) or ¬ (the Unicode not sign)
#
# See also: not, est, is not
# =============================================================================
# unarius — negation, logical not, sign comparisons, and optional presence
#
# -<expr> not <bool> <expr> > 0 <expr> < 0
# <expr> est none <expr> is not none
#
# GRAMMAR:
# unaryExpr :← ('-' | 'not') expr
#
# EXPECTED OUTPUT:
# unarius.expected — unary operator samples.
main {
# Numeric negation
const int x ← 5
const int neg ← -x
# -5
print neg
# Logical negation
const bool flag ← true
const bool non_signum ← not flag
# false
print non_signum
# Positive/negative checks
const int a ← 10
const int b ← -3
# true
print a ≻ 0
# false
print a ≺ 0
# false
print b ≻ 0
# true
print b ≺ 0
# Null checks
const string ∪ none forsitan ← null
# true
print forsitan is none
# false
print forsitan not is none
const string ∪ none adest ← "salve"
# false
print adest is none
# true
print adest not is none
}Expected output:
-5
falsum
verum
falsum
falsum
verum
verum
falsum
falsum
verum