Computer Science, asked by nancyyy, 1 year ago

difference between if statements and switch case statements.

Answers

Answered by zeeshan3828
20
if statement which checks whether the condition is true or false

Switch statement which has a number of choices to choose from under different cases

nancyyy: can you give another point please
zeeshan3828: yes!
zeeshan3828: on which point about?
zeeshan3828: if statement if the condition is true then the block of statement will be executed otherwise else block will be executed
Answered by siddhartharao77
25

Short note on if and switch case statements:


= > if statements validates multiple conditions at a time. Switch can validate only one condition at a time.


= > In if statements we cannot define default statement. Switch statement we can define default statement.


= > if statements works under the Boolean literal.Switch statement works under integer literal.



Hope it helps!


nancyyy: thanks a lot :D
siddhartharao77: Welcome
Similar questions