top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is a default case necessary in a switch statement?

+3 votes
371 views
Is a default case necessary in a switch statement?
posted Feb 1, 2016 by Maha Lakshmi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

No, it is not necessary to have default within the switch. But the good programming practices recommend to have default case in switch statement and also break; within each "case" as well as within the "default".

answer Feb 1, 2016 by Vimal Kumar Mishra
...