liveBook · Manning

Early return

An early return is a control-flow technique in which a function exits before reaching its normal completion point.

How 2 Manning books explain it

React Quickly, Second Edition

An early return exits a function before its later statements execute when a condition makes further processing unnecessary.

How it is used
Uses early return to render nothing when a React component’s condition makes further rendering unnecessary.
How deep it goes
Explains the null-return pattern and its short-circuiting rationale, but stops short of broader component-branching alternatives.
Examples
Uses a Countdown component that returns null at zero before calculating minutes, seconds, and JSX.
What you can do after
Apply early return to simplify components that render nothing under a stopping condition.

Read how React Quickly, Second Edition explains early return →

High Performance Unity Game Development

An early return is a control-flow technique in which a function exits before reaching its normal completion point.

How it is used
Use early returns to leave a function when a condition blocks its remaining work, while weighing readability and skipped end-of-function actions.
How deep it goes
Contrast wrapped conditionals, early exits, and caller-side checks, then discuss skipped work and validation boundaries.
Examples
Illustrate a game-over return in Tick() and a paralysis check moved outside moveEnemy().
What you can do after
Evaluate whether a return is useful or risks skipping required updates, and decide whether a check belongs at a system boundary or caller.

Read how High Performance Unity Game Development explains early return →

Also covered in

What to know first

Related concepts

Questions about early return

What is early return?

An early return is a control-flow technique in which a function exits before reaching its normal completion point.

Which Manning books explain early return?

React Quickly, Second Edition and High Performance Unity Game Development.

What should I know before learning early return?

Manning books that teach early return usually introduce Rust first.

What is the difference between early return and React hook?

An early return is a control-flow technique in which a function exits before reaching its normal completion point. A React Hook is a function-based API that enables function components to access state, effects, context, and other React capabilities.

What is early return a kind of?

Early return is a kind of return statement. A return statement ends the current function or routine invocation and optionally supplies its result to the caller.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.