#MonthOfCode - Day 10: switch
My entry for the 10th day of the month of code. The theme for today is: switch.
Today, the code is just an usage of the switch statement that you might not know.
You can switch on the value true and use conditions in the case statements:
1 |
|
It’s equivalent to a series of if-elseif statements. It’s only a matter of
style. On notable difference is when you have lots of ||. There can be turned
into multiple case statements:
1 |
|