Pattern Matching • Exercise 3/4

Guard Clauses in Patterns

00:00
0
20 points

Instructions

Create a function describe_number that uses pattern matching with guards.

Return:
- "zero" for 0
- "positive" for numbers > 0
- "negative" for numbers < 0

Use guard clauses with if:
ruby
case n
in x if x > 0
"positive"
end

Your Code

Results

Click "Run Tests" to see results