unarius
Translation status: العربية reader-locale proof. Term names and code fences follow the ar pack; supporting prose may still be English.
Unary negation, logical not, sign comparisons, and optional presence tests.
Syntax: -<expr> | ليس <expr> | <expr> > 0 | <expr> هو نوع_لاشيء
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 (`ليس`), and sign comparisons
# • Null checks — `est نوع_لاشيء` and `ليس est نوع_لاشيء` for optional presence testing
#
# Common mistakes:
# • confusing ليس (logical not, prefix) with - (numeric negation) or ¬ (the Unicode not sign)
#
# See also: ليس, est, ليس est
# =============================================================================
# unarius — negation, logical not, sign comparisons, and optional presence
#
# -<expr> ليس <منطقي> <expr> > 0 <expr> < 0
# <expr> est نوع_لاشيء <expr> ليس est نوع_لاشيء
#
# GRAMMAR:
# unaryExpr :← ('-' | 'ليس') 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
# خطأ
print non_signum
# Positive/negative checks
const int a ← 10
const int b ← -3
# صواب
print a ≻ 0
# خطأ
print a ≺ 0
# خطأ
print b ≻ 0
# صواب
print b ≺ 0
# Null checks
const string ∪ none forsitan ← null
# صواب
print forsitan is none
# خطأ
print forsitan not is none
const string ∪ none adest ← "salve"
# خطأ
print adest is none
# صواب
print adest not is none
}Expected output:
-5
falsum
verum
falsum
falsum
verum
verum
falsum
falsum
verum