Consider the following code:
fruit = "orange" case fruit # from w w w . j a v a 2s . c o m when "orange" color = "orange" when "apple" color = "green" when "banana" color = "yellow" else color = "unknown" end