You may encounter situations, when a block of code needs to be executed several number of times. In general, statements are executed sequentially i.e. The first statement in a function is executed first, followed by the second, and so on. But in our programs, there may be a need of doing repetitive work which can be easily done with the help of loops.
By sorting, we simply mean to arrange items in a particular order. The items may be placed alphabetically, increasingly or decreasingly. The words can be arranged alphabetically whereas numbers can be arranged in increasing or decreasing order.
The switch case is an alternative of if…else statement which does almost the same thing. The switch case statement tests a variable against a series of values until it finds its match.
When you write a code for developing your web page, you may have the situations where you want to handle some statements of your code with some conditions.