3 ms·
Either you will break, thus exiting the switch-case block or you will fall-through. The fall-through behavior won't do what you want: > the script will run fro
by Sayrus 6y ago
Either you will break, thus exiting the switch-case block or you will fall-through. The fall-through behavior won't do what you want:
> the script will run from the case where the criterion is met and will run the cases after that regardless if a criterion was met.
Using the switch method won't allow you to return several errors while the simple ifs method described earlier could accumulate the errors and return later. The switch method is elegant though.