When does an if statement prove to be more advantageous over a switch STATEMENT
PLEASE Answer in ur own words
Answers
Answered by
3
the best practice for using a switch statement vs using an if statement for 30 unsigned enumerations where about 10 have an expected action (that presently is the same action). Performance and space need to be considered but are not critical. I've abstracted the snippet so don't hate me for the naming conventions.
Answered by
0
// Kinda Perplexed Question.
Advantageous of if over switch:
(i) If statement is the best choice when dealing with multiple conditions at a time.
(ii) If statement is popular for nesting of a loop - statement can be found under another if function.
(ii) If statement has to be true to be executed further.
Example:
age = 13;
if(age >= 12 && age <= 19)
{
printf("Welcome");
}
Hope it helps!
Similar questions