Re:Avoid Else, Return Early (2013)
by icc97 on Monday March 26, 2018 @09:06AM
(#16678530)
The pre-conditions are called Guard Clauses [0]. It's really useful to think about guard clauses and explicitly look for them to ensure the pre-conditions are met rather than have them appear over time as if/else blocks.
edit: now that I've looked through the comments I see these are mentioned on numerous other threads.
edit: now that I've looked through the comments I see these are mentioned on numerous other threads.
[0]: https://en.wikipedia.org/wiki/Guard_%28computer_science%29