Shortcut to make case/switch return a value

Viewed 12694

I'm pretty sure I saw someone do a shortcut technique like the code below (which doesn't work)

return case guess
  when guess > @answer then :high
  when guess < @answer then :low
  else :correct
end

Does anyone know the trick I'm referring to?

4 Answers
Related