Why can't we write default case at the begining in the switch loop? Is it compulsory to write it at end only?
I would like to write default at begining with break statement. is that fine?
Granted that you placed a break after the default case, it will work the same way no matter where it is placed within a switch statement.
It will works the same if you put default statement even in the beginning, position does not matters inside a switch statement.