Guillaume Nargeot wrote:
> # Example 1
> x = ["case4"]
>
> case x
>   when ["case1", "case2"]
>     puts "first case"
>   when ["case3", "case4", "case5"]
>     puts "second case"
>   when ["case6"]
>     puts "third case"
>   else
>     puts "not matched"
> end
>
> # Returns: "second case"
>
> # Example 2
> x = [6]
>
> case x
>   when [1, 2]
>     puts "first case"
>   when [3, 4, 5]
>     puts "second case"
>   when [6]
>     puts "third case"
>   else
>     puts "not matched"
> end
>
> # Returns: "third case"
>
> What do you think about it ?
>   
You can already do this:

a = [3, 4, 5]
case x
  when 1, 2
    puts "first case"
  when *a
    puts "second case"
  when 6
    puts "third case"
  else
    puts "not matched"
end

There are cases of C's fall-through switch, that cannot be emulated by Ruby's case - and I think that's a good thing. To make breaks necessary to break out of a case clause (and creating the danger for programmers to incidentally forget one), was probably one of the most inane ideas of the C language's creators.

-- 
Florian Frank