Hacker News new | ask | show | jobs
by sherwin 5079 days ago
I think Ruby does a pretty good job with this, as far as an object oriented main stream language goes. For example, the switch case example from the article can be implemented in ruby as case n: when 1: "one" when 2: "two"

etc, and the entire construct can be assigned to a variable because it is an expression.

As an aside, ruby 1.9 also supports generic predicates for case statements through lambdas, which is very concise and powerful. Example: https://gist.github.com/838163, source: http://flazz.me/predicates-in-ruby-case-statements