Skip to content

Glossary: Refactoring and Clean Code

Guard clause

Also written: guard clauses

An `if` at the top of a function that handles a special case and returns at once. It flattens deep nesting, as in `shipping_cost`.

Where the book teaches it

Related terms

early returndeep nesting