Return type
A return type is the declared or inferred type of the value that a function or method supplies to its caller.
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.
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.
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
- function declarationpart of · A function declaration is a source-language construct that specifies a function’s name and parameter interface, and may include its implementation.
- TypeScript compilerproduced by · The TypeScript compiler analyzes and checks TypeScript source code and can emit JavaScript and declaration files.
- functionpart of · A function is a callable program unit that performs an operation, may accept inputs, and can produce a result or side effect.
- type hintsconfigured by · Type hints are source-code annotations that indicate the intended or expected types of program elements and can support documentation, tooling, or type checking.
- promisecontrasts with · A JavaScript Promise is an object representing the eventual completion or failure of an asynchronous operation and its resulting value or reason.
- exceptioncontrasts with · An exception is a runtime signal or object representing an abnormal condition that interrupts ordinary program flow and may be handled or propagated.
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.



