News for hackers. Stuff that matters.
Re:Using the switch(true) pattern in JavaScript by speedyapoc on Monday April 12, 2021 @03:32PM (#26784037)
I recall this pattern being taught in my first year or two of my computer science degree. Emphasizing only one return statement per function, utilizing a shared return variable.

I much preferred (and still greatly prefer in industry) the pattern of exiting the function as soon as possible.

Re:Using the switch(true) pattern in JavaScript by cryptonector on Monday April 12, 2021 @04:07PM (#26784483)
It's like "goto considered harmless" -- structured code to max, to the point of unreadability. Dogmatism has drawbacks.
Re:Using the switch(true) pattern in JavaScript by jbverschoor on Monday April 12, 2021 @03:41PM (#26784160)
Same here.

Returning and throwing quickly and strict.