Booleans (Bits)

← Back to documentation


Description

Boolean values in Jaf are represented as numbers: 1 for true, 0 for false.

Examples

Comparison results

print(5 > 3)    # 1 (true)
print(5 == 3)   # 0 (false)
print(5 != 3)   # 1 (true)

Logical operations

print(1 && 1)   # 1
print(1 && 0)   # 0
print(1 || 0)   # 1
print(0 || 0)   # 0

Using in conditions

debug = 1
if (debug) {
    print("Debug mode on")
}
# Output: Debug mode on

debug = 0
if (debug) {
    print("This won't print")
}

Truthiness

In conditions, any non-zero value is considered true:

if (42) { print("True!") }   # Prints
if (-5) { print("True!") }   # Prints
if (0) { print("False!") }   # Doesn't print

See Also


© 2026 elliktronic · Jaf Language