mathiyazhagan


{ City } chennai
< Country > india
* Profession * student
User No # 1940
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 29
Users Marked my Answers as Wrong # 25
Questions / { mathiyazhagan }
Questions Answers Category Views Company eMail




Answers / { mathiyazhagan }

Question { Oracle, 73307 }

what is the different between if-else and switch statment
(other than syntax)


Answer

Though both are Braching statements,The selection of
statement is depending on developers.for simple
comparisions,there is no need to SWITCH statement.switch
statement will not use to compare floating,String and
logical expressions.
we can also use switch statement to somple
comparisons ,though it not fair as following segments :
switch(a>b)
{
case 0 :
max=a;
break;
case 1 :
max=b;
break;
}
I want to conclude that if...else structure is more
flexible and reliable than switch statement.

Is This Answer Correct ?    29 Yes 25 No