liveBook · Manning

Short-circuit evaluation

Also called short-circuiting

Short-circuiting is early termination of a computation or processing sequence when a condition or result makes further steps unnecessary.

How 3 Manning books explain it

ASP.NET Core in Action, 3e

A short circuit is the termination of request-processing pipeline execution by returning a result without invoking the remaining components.

How it is used
Stops endpoint, MVC, or Razor Pages processing when a filter can produce the response without invoking later pipeline stages.
How deep it goes
Explains continuation, filter order, stage-specific bypass, and earlier-filter callbacks, while deferring some result-filter details.
Examples
Demonstrates invalid identifier validation, a Problem Details response, ordered logging filters, and a minimal API returning fruit data.
What you can do after
Apply it via endpoint or MVC filters by returning a result before invoking the remaining pipeline.

Read how ASP.NET Core in Action, 3e explains short-circuit evaluation →

Clojure: The Essential Reference

Short-circuit evaluation is an evaluation strategy that skips operands whose results cannot affect the overall logical result.

How it is used
Uses left-to-right operand skipping to end logical chains once their result is determined.
How deep it goes
Details return values, zero-argument cases, practical guards, and macro expansion rather than a general evaluation model.
Examples
Demonstrates file-path guarding, a default server port, predicate filtering, and spam detection.
What you can do after
Apply it via Clojure `and` and `or` for guards and defaults, or via `every-pred` and `some-fn` for combined predicates.

Read how Clojure: The Essential Reference explains short-circuit evaluation →

100 Java Mistakes and How to Avoid Them

A short-circuit operator is a Java boolean operator that skips evaluation of its right operand when the result is already determined by the left operand.

How it is used
Prevents incorrect conditions, unnecessary computation, and runtime exceptions caused by eager boolean evaluation.
How deep it goes
Explains operand evaluation, compound-assignment behavior, and precedence hazards through focused Java examples.
Examples
Uses array bounds checks, chained validation calls, mixed logical conditions, and independently evaluated update methods.
What you can do after
Diagnose/debug with it by spotting eager operators and rewriting conditions or assignments that should skip later operands.

Read how 100 Java Mistakes and How to Avoid Them explains short-circuit evaluation →

Also covered in

What to know first

Related concepts

Questions about short-circuit evaluation

What is short-circuit evaluation?

Short-circuiting is early termination of a computation or processing sequence when a condition or result makes further steps unnecessary.

Which Manning books explain short-circuit evaluation?

ASP.NET Core in Action, 3e, Clojure: The Essential Reference and 100 Java Mistakes and How to Avoid Them.

What should I know before learning short-circuit evaluation?

Manning books that teach short-circuit evaluation usually introduce lambda first.

What is the difference between short-circuit evaluation and non-short-circuit operator?

Short-circuiting is early termination of a computation or processing sequence when a condition or result makes further steps unnecessary. A non-short-circuit operator is a Java boolean operator that evaluates both operands regardless of whether the left operand already determines the result.

What is short-circuit evaluation also called?

Short-circuit evaluation is also called short-circuiting.

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.