Complete the code to match the variable 'score' with the correct range in the case statement.
score = 75 case score when [1] puts "Passed" else puts "Failed" end
The range 50..100 correctly matches scores that are passing (including 75).
Complete the code to print the correct message for the variable 'age' using a case statement with ranges.
age = 20 case age when [1] puts "Teenager" when 20..29 puts "Twenties" else puts "Other age" end
The range 13..19 correctly matches teenagers.
Fix the error in the case statement to correctly match the variable 'grade' with letter grades.
grade = 'B' case grade when [1] puts "Excellent" when 'B' puts "Good" else puts "Needs Improvement" end
The case statement matches strings, so the letter grade must be in quotes like 'A'.
Fill both blanks to create a case statement that matches 'temperature' with descriptive ranges.
temperature = 15 case temperature when [1] puts "Cold" when [2] puts "Warm" else puts "Hot" end
The range 0..10 matches cold temperatures, and 11..20 matches warm temperatures.
Fill both blanks to create a case statement that matches 'day' with weekdays and weekends.
day = 'Saturday' case day when [1] puts "Weekday" when [2] puts "Weekend" else puts "Invalid day" end
The regex pattern /Monday|Tuesday|Wednesday|Thursday|Friday/ matches weekdays, and /Saturday|Sunday/ matches weekends.