| Operator | Description | Truth Table |
|---|---|---|
&& |
Logical AND | 1 && 1 = 1 1 && 0 = 0 0 && 1 = 0 0 && 0 = 0 |
|| |
Logical OR | 1 || 1 = 1 1 || 0 = 1 0 || 1 = 1 0 || 0 = 0 |
print(1 && 1) # 1 print(1 && 0) # 0 print(1 || 0) # 1 print(0 || 0) # 0
x = 10 y = 20 result = (x > 5) && (y < 30) print(result) # Output: 1 result = (x > 15) && (y < 30) print(result) # Output: 0
age = 25 hasLicense = 1 canDrive = (age >= 18) && hasLicense print(canDrive) # Output: 1
# AND: if left is false, right is not evaluated x = 0 y = 10 result = (x != 0) && (y / x > 5) # No division by zero print(result) # Output: 0
Any non-zero value is considered true:
print(42 && 1) # 1 (true) print(-5 && 0) # 0 (false) print(3.14 || 0) # 1 (true)
© 2026 elliktronic · Jaf Language