Ruby - Control Flow
What is the output of this Ruby code?
grade = 'B' case grade when 'A' puts "Excellent" when 'B', 'C' puts "Good" when 'D' puts "Pass" else puts "Fail" end
What is the output of this Ruby code?
grade = 'B' case grade when 'A' puts "Excellent" when 'B', 'C' puts "Good" when 'D' puts "Pass" else puts "Fail" end
grade is set to 'B'.when 'B', 'C' line matches 'B', so it runs puts "Good".15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions