Conditional execution. if is an expression that returns a value.
if (condition) expression else expression
condition - any expression that returns a number (0 = false, non-zero = true)expression - executed based on conditionValue of the executed branch
x = 10 result = if (x > 5) 100 else 0 print(result) # Output: 100
x = 3 result = if (x > 5) 100 print(result) # Output: void
x = 15
result = if (x > 10) {
print("Large")
x * 2
} else {
print("Small")
x
}
print(result)
# Output:
# Large
# 30
grade = if (score >= 90) {
"A"
} else {
if (score >= 80) {
"B"
} else {
"C"
}
}
© 2026 elliktronic · Jaf Language