+ 1
In the switch stament,why is there a default statement at the end?
6 Answers
+ 5
If no case executes then default will execute.... It will deal with no case match condition
+ 1
Yeah just went over it...its clear now...thanks
+ 1
cases are basically if/else ifs and the default statement is basically an else statement. you also dont NEED a default statement if you cant find a use for one
0
Ok so what the function of the default statement?
0
The default case can be used for performing a task when none of the cases is true. No break is needed in the default case.
0
If no one of the cases is true, the object inside the default statement will be executed.