Check out example codes for "switch statement in apex". It will help you in understanding the concepts better.

Code Example 1

for(Integer i=1; i<=5; i++){
    Switch on i {
        when 1,2{
            System.debug('case 1 and 2');
        }
        when 5{
            System.debug('case 5');
        }
        when else{
            System.debug('case 3 and 4');
        }
    }
 }

Learn ReactJs, React Native from akashmittal.com