early return
Coming back soon
In programming, an early return exits a function before reaching its natural end, typically when a condition makes further execution unnecessary.
Rather than nesting logic inside conditionals, early returns handle edge cases upfront: if the input is invalid, return an error immediately.
The pattern reduces indentation and clarifies intent, though some style guides discourage multiple exit points.
Occurring before expected
- ahead of scheduleBefore the planned time
- cut shortEnd before completion
- unexpectedNot anticipated beforehand
- abruptSharp and unexpected
Way to leave
- short-circuitUnintended electrical path
- conditionalDependent on prerequisites
- functionPurpose or duty
- breakInterrupt continuity
refactor · nested · validation · error handling · exception · bail out · precondition · clean code
Profit-to-cost ratio
- yieldProduce or relinquish
- dividendCorporate profit share
- profitGain exceeding expenditure
- capital gainsProfit from asset sales
short-term gain · liquidity · payout · earnings · appreciation · maturity · redemption · principal
premature
Occurring before expected
- ahead of scheduleBefore the planned time
- cut shortEnd before completion
- unexpectedNot anticipated beforehand
abrupt · unforeseen · sudden · ahead of time
exit
Way to leave
- short-circuitUnintended electrical path
- conditionalDependent on prerequisites
- functionPurpose or duty
break · refactor · nested · validation · error handling · exception · bail out · precondition · clean code · readability
ROI
Profit-to-cost ratio
capital gains · short-term gain · liquidity · payout · earnings · appreciation · maturity · redemption · principal · investment
tennis
Racquet sport over net
forehand · backhand · rally · receiver · service game