liveBook · Manning

Return value

A return value is the result produced by a function, method, or operation and supplied to the code that invoked it.

How 8 Manning books explain it

Python How-To

The value produced by a function call, either explicitly by a return statement or implicitly when execution reaches the end of the function.

How it is used
Uses return values as the outputs of Python function calls that callers can assign and use.
How deep it goes
Works through explicit and implicit returns, None, tuple results, and unpacking, then gives guidance on how many values to return.
Examples
Contrasts sum with list.sort(), shows a function that appends but returns None, and calculates two statistics in one call.
What you can do after
Build it from scratch: define clear function outputs, unpack related results, and avoid chaining calls onto an unexpected None.

Read how Python How-To explains return value →

The Well-Grounded Rubyist, Fourth Edition

A return value is the value produced by evaluating a Ruby method call, implicitly taken from the method's last evaluated expression unless execution returns earlier.

How it is used
Connects method calls to expression values, object queries, and the results of iteration.
How deep it goes
Explains implicit and explicit returns, early exit, empty methods, multiple values, and the distinction between block results and method results.
Examples
Uses temperature conversion, ticket queries, irb iteration output, and a hand-built map accumulator.
What you can do after
Build it from scratch: implement a map-like method that collects block results and returns the resulting array.

Read how The Well-Grounded Rubyist, Fourth Edition explains return value →

Learn AI-Assisted Python Programming, Second Edition

A return value is the result that a function sends back to the code that called it.

How it is used
Uses returned results to connect function calls, later computation, and testing.
How deep it goes
Explains calls, arguments, assignment, and test categories, but stops short of implementation internals.
Examples
Shows larger, money_made, max, input, and password-validation functions returning values.
What you can do after
Apply it via Python by capturing function results, inspecting outputs, and testing varied inputs.

Read how Learn AI-Assisted Python Programming, Second Edition explains return value →

The Art of Unit Testing 3e

A return value is data produced by a function and delivered to its caller when the function completes.

How it is used
Uses return values as preferred observable exit points for value-based unit tests.
How deep it goes
Defines return values as observable exit points and contrasts them with state changes and third-party calls, treating them as testing boundaries.
Examples
Uses a number-summing function and a password verifier that returns booleans while calling an internal helper.
What you can do after
Evaluate/understand unit-test targets by asserting a function’s return value instead of its internal calls when possible.

Read how The Art of Unit Testing 3e explains return value →

The Quick Python Book, Fourth Edition

A return value is the result supplied by a function to its caller when the function completes execution.

How it is used
Uses returned results to pass computed data from functions to calling code and support refactoring into reusable functions.
How deep it goes
Explains explicit and implicit returns, early termination, discarded results, assignment, and name-collision failure, without covering implementation internals.
Examples
Demonstrates factorial computation, displayed versus assigned results, and text-cleaning functions used in a word-processing pipeline.
What you can do after
Apply it via Python functions to capture results, discard them deliberately, return early, and avoid callable-name collisions.

Read how The Quick Python Book, Fourth Edition explains return value →

The Well-Grounded Python Developer: How the pros use Python and Flask

A function return value is the object supplied by a function to the caller when the function completes.

How it is used
Defines function output as reusable data within API contracts and application-level function orchestration.
How deep it goes
Explains scalar results, compound tuples, implicit None, status flags, unpacking, reuse, and testability.
Examples
Uses abs, split_fullname tuple unpacking, and a full_name refactoring from printing to returning.
What you can do after
Apply it by returning reusable data, unpacking compound results, reporting operation status, and testing outputs directly.

Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains return value →

Grokking Simplicity

The value produced as the result of a function invocation.

How it is used
Separates calculations from actions so callers can reuse results in the DOM, accounting, shipping, or further calculations.
How deep it goes
Defines explicit outputs, contrasts synchronous returns with asynchronous callbacks, and stops short of broader asynchronous abstractions.
Examples
Uses shopping-cart totals, DOM updates, shipping calculations, accounting reuse, and a synchronous-versus-asynchronous pet-count example.
What you can do after
Apply it to extract calculations, return reusable results, and replace asynchronous returns with callbacks.

Read how Grokking Simplicity explains return value →

Statistics Slam Dunk

A return value is the output produced by a function after it runs.

How it is used
Uses return values to explain how built-in and user-defined R functions produce usable analytical outputs.
How deep it goes
Defines return values and demonstrates explicit returns in custom functions, without descending into evaluation internals.
Examples
Demonstrates mean(), correlation conversion, and a Gini estimate with numeric outputs and a missing-argument error.
What you can do after
Build it from scratch by writing R functions that calculate, return, and reuse derived values.

Read how Statistics Slam Dunk explains return value →

Related concepts

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.