Hello, Sri.
If statement is used for small case in which we know the the possibilities are small and switch case are use for large possibilities because the switch take more time to run as if statement. Switch looks better and you can use a default return value in case none meet the condition . Just be careful with the breaks if not it will break you.
Question and answer is powered by AnsPress.io