Conditions (If-Else & Match)
Control flow structures let your script make decisions depending on boolean expressions or value patterns.
If, Elif, Else
The conditional syntax uses if, elif, else, and concludes with the end keyword:
let score = 85
if score >= 90
print("Grade: A")
elif score >= 80
print("Grade: B")
elif score >= 70
print("Grade: C")
else
print("Grade: F")
end
Ternary Conditional Expression
Djazair supports a ternary operator syntax that begins with an if statement inline:
let age = 19
let category = if age >= 18 ? "Adult" else "Minor"
print(category) # => Adult
Match / Case / Default
Pattern matching for multi-way branching. Case values are literal comparisons with no fall-through:
let day = 6
match day
case 6
print("Saturday")
case 7
print("Sunday")
default
print("Weekday")
end