Here's the general format of the Ruby case statement: : case « Statement « Ruby






Here's the general format of the Ruby case statement:


case value
  when expression [, comparison]...[then | :]
    code
  when expression [, comparison]...[then | :]
    code
  .
  .
  .
  [else
    code]
end

 








Related examples in the same category

1.Using the case Statement
2.If vs Case
3.case...when with range
4.use exculsive ranges in case statements
5.use a case statement to make an assignment, which omits the value to test
6.elsif and case
7.All Ruby expressions return a result
8.Case with regular expression