1.

Keeping In Mind The Efficiency, Which One Between If-else And Switch Is More Efficient?

Answer»
  • Between if-else CHAIN and switch statements, as far as efficiency is concerned it is hard to say that which one is more efficient because both of them POSSES hardly any difference in terms of efficiency. 
  • Switch can ne converted into if else chain INTERNALLY by the compiler.
  • Switch statements are compact way of writting a jump table whereas if-else is a LONG way of writting conditions.
  • Between if-esle and switch statements, switch cases are prefered to be used in the programming as it is a compact and cleaner way of writting conditions in the program.



Discussion

No Comment Found