Mega Code Archive
All Ruby expressions return a result
# you assign the result of whichever inner block is executed directly to color.
fruit = "orange"
color = case fruit
when "orange"
"orange"
when "apple"
"green"
when "banana"
"yellow"
else
"unknown"
end