Changes

The Ruby case Statement

64 bytes added, 13:28, 20 April 2009
Ruby Flow Control
''result'' = case ''value''<br>
&nbsp;&nbsp;&nbsp;when ''match1'': then ''result1''<br>&nbsp;&nbsp;&nbsp;when ''match2'': then ''result2''<br>&nbsp;&nbsp;&nbsp;when ''match3'': then ''result3''<br>&nbsp;&nbsp;&nbsp;when ''match4'': then ''result4''<br>&nbsp;&nbsp;&nbsp;when ''match5'': then ''result5''<br>&nbsp;&nbsp;&nbsp;when ''match6'': then ''result6''<br>
&nbsp;&nbsp;&nbsp;else ''result7''<br>
end<br>
manufacturer = case car
when "Focus": then "Ford" when "Navigator": then "Lincoln" when "Camry": then "Toyota" when "Civic": then "Honda" when "Patriot": then "Jeep" when "Jetta": then "VW" when "Ceyene": then "Porsche" when "Outback": then "Subaru" when "520i": then "BMW" when "Tundra": then "Nissan"
else "Unknown"
end