Javatpoint Logo
Javatpoint Logo

Ruby Case Statement

In 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:

Ruby switch 1

Look at the above output, conditions are case sensitive. Hence, the output for 'Saturday' and 'saturday' are different.


Next TopicRuby for loop





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA