+ 1

What is the best scenario where one uses switch statements in creating a website???

27th Apr 2020, 1:20 PM
Sarah Juma
Sarah Juma - avatar
2 Answers
+ 11
switch (user.getRole()) { case 1: // Admin loadAllPosts(); break; case 2: // Moderator loadHeldForModerationPosts(); break; default: // Regular user loadVisiblePosts(); }
27th Apr 2020, 3:58 PM
Igor Makarsky
Igor Makarsky - avatar
+ 1
Igor Makarsky Thankyou
28th Apr 2020, 8:14 PM
Sarah Juma
Sarah Juma - avatar