When To Use Switch Vs If?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Switch statements should be used when you have multiple conditions that could be true and you want to execute a different block of code for each condition. If statements should be used when you have a single condition and you want to execute one block of code if that condition is true and another block of code if that condition is false.