In case statement, case nil and range

this code doesn’t compile.

ch = nil
case ch
when 'A' .. 'Z'
  puts "ch is capital"
when Nil
  puts "ch is nil"

In case statement, if no range expression, it is compiled successfully.

Put the when Nil first, would be the easiest way to fix this.

It’s a bug, please report it. Thank you!

1 Like