How does N==S in switch case?

Hi,

Please let me know how does switch case checks for a condition? because in the example that the instructor discussed, he mentioned when ch=‘N’ then, it prints North, South, West and East. But how can that be possible? because N!=S, so why did it print South and the rest as well?

hi @learninguser,
if you’ll not write break it will continue to execute other statements ( in the lecture also bhaiya explained it watch till end)

For your information, I have gone through the explanation till the end of the video before posting a question on the forum.

I think the answer for my query is:

the other statements in the other cases will also execute irrespective whether they are satisfied or not. In order to prevent that we write a break statement, so the other cases will not be executed.

@learninguser I guess that’s what I wrote

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.