if else if and switch
When will go for if else if and switch?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Midhun TpPosted Aug 18, 2016, 10:57 AM
If you have a series of statements to check and only one among them will be true, then you can go with else if statement.
Rajeesh MenothPosted Aug 19, 2016, 1:02 AM
Nitin SontakkePosted Aug 18, 2016, 11:58 AM
Tapan PatelPosted Aug 18, 2016, 11:11 AM
Here is what you can do.
Actually you can use alternatively but going with if else requires compiler to do some extra work in case you have complex logic in conditions. Alternatively because, you can do something as