रेंडरिंगhi

unarius

Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi 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

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