switch statement is faster to execute than the if-else-if ladder. This is
due to the compiler's ability to optimise the switch statement. In the case
of the if-else-if ladder, the code must process each if statement in the
order determined by the programmer. However, because each case within a
switch statement does not rely on earlier cases, the compiler is able to
re-order the testing in such a way as to provide the fastest execution.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to