Re:Ask HN: What lessons did you learn from your best or wors...
by Izkata on Sunday May 16, 2021 @04:35AM
(#27172183)
This particular use of an if statement is subset of what's called a "guard clause", and I'm also a major fan of them. Other guards include an early return for edge cases or that would make the more general path more complicated, rather than just exceptions.
https://wiki.c2.com/?GuardClause/