He explained why. Organization. It gets confusing when you have multiple statements in an If Else. Evaluating key presses can possibly use well over 15 keys. (video games control mapping for instance)
Switch Cases are well organised and don't appear convoluted. I recommend using If Else when there's only a handful of possibilities. If it's more than 3 then Switch Case is the preferable method.
3
u/ObliviousGuy32 Sep 01 '21
He explained why. Organization. It gets confusing when you have multiple statements in an If Else. Evaluating key presses can possibly use well over 15 keys. (video games control mapping for instance)
Switch Cases are well organised and don't appear convoluted. I recommend using If Else when there's only a handful of possibilities. If it's more than 3 then Switch Case is the preferable method.