liveBook · Manning

Local function

A local function is a named function declared within another function or local scope and accessible within that enclosing lexical context.

How 2 Manning books explain it

Kotlin in Action, 2E

A local function is a function declared within another function or local scope rather than at the top level or as a class member.

How it is used
Structures function-specific helper logic while avoiding duplicated validation and unnecessary class methods.
How deep it goes
Explains nesting, scope, duplication removal, and captured parameters, then stops at an extension-function alternative.
Examples
Uses saveUser validation for empty name and address fields, first passing User explicitly and then capturing it.
What you can do after
Apply it in Kotlin to organize function-local validation and remove small repetitions without expanding a class API.

Read how Kotlin in Action, 2E explains local function →

React Quickly, Second Edition

A local function is a function defined within another function and accessible within that enclosing function's lexical scope.

How it is used
Converts class methods that depend on component-local information into functional-component code.
How deep it goes
Compares pure and local functions with concrete calls and JSX, but does not develop deeper implementation internals.
Examples
Uses an Image component whose local getImageSource function builds a Picsum image URL from index.
What you can do after
Apply it via functional components to retain compact calls while accessing component-local values.

Read how React Quickly, Second Edition explains local function →

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.