Loading...
beginner
Problem 03 • Step 01
Compare Two Values
Your evaluator works with numbers, but it can’t yet ask questions like “is this bigger than that?”
Comparison operators produce booleans — true or false. They work just like arithmetic operators: evaluate both sides, then apply the operator.
For example:
evaluate([5, ">", 3]) // -> true
evaluate([2, "<", 1]) // -> false
The left and right sides can be any expression, not just numbers:
evaluate([[2, "+", 3], ">", 4]) // -> true
Fill in the "l < r" and "l > r" rules. Follow the same pattern as arithmetic — evaluate both sides first, then compare.