Ruby Case StatementIn Ruby, we use 'case' instead of 'switch' and 'when' instead of 'case'. The case statement matches one statement with multiple conditions just like a switch statement in other languages. Syntax: Example: Output: Look at the above output, conditions are case sensitive. Hence, the output for 'Saturday' and 'saturday' are different.
Next TopicRuby for loop
|