liveBook · Manning

Return type

A return type is the declared or inferred type of the value that a function or method supplies to its caller.

How 4 Manning books explain it

Kotlin in Action, 2E

A return type is the statically determined type of the value returned by a function.

How it is used
Defines the result type of Kotlin functions and makes returned values visible at the declaration site.
How deep it goes
Explains declaration syntax, expression bodies, type inference, block-body restrictions, and public-API guidance.
Examples
Uses max, if, when, try, main, and command-line arguments to demonstrate returned values and functions without values.
What you can do after
Apply explicit and inferred return types when declaring Kotlin functions, including concise expression-body functions.

Read how Kotlin in Action, 2E explains return type →

Essential TypeScript 5, Third Edition

A return type is the type of the value a function returns, whether inferred or specified by annotation.

How it is used
Clarifies what functions return, supports compiler checking, and makes optional or action-oriented results explicit.
How deep it goes
Explains inference, unions, annotations, void, and noImplicitReturns, but does not descend into function overload implementation.
Examples
Demonstrates calculateTax with numeric, number-or-undefined, and void console-writing results.
What you can do after
Evaluate function contracts, annotate results, interpret inferred unions, and diagnose incomplete return paths.

Read how Essential TypeScript 5, Third Edition explains return type →

Modern C, Third Edition

A return type is the type of value that a C function supplies to its caller, or void when it supplies no value.

How it is used
Uses return types to define function interfaces and guide how callers handle returned data.
How deep it goes
Explains prototypes, void conventions, and caller-side expression effects, but does not develop return-type rules beyond these examples.
Examples
Uses leapyear returning bool, swap_double returning void, and fbar returning double in an arithmetic expression.
What you can do after
Build it from scratch by declaring functions with appropriate parameter and return types and using their results correctly.

Read how Modern C, Third Edition explains return type →

Learn Rust in a Month of Lunches

A return type is the type of value that a function produces when it completes.

How it is used
Explains how Rust functions communicate values to their callers.
How deep it goes
Connects arrow syntax, tail expressions, semicolons, unit type, early return, and compiler diagnostics.
Examples
Uses `give_number` returning `8` and `multiply` returning a calculated product.
What you can do after
Diagnose return-type mismatches and write functions that return values implicitly or early.

Read how Learn Rust in a Month of Lunches explains return type →

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.