Ruby Case

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

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.



Ruby switch 1

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