Function
A function is a callable program unit that performs an operation, may accept inputs, and can produce a result or side effect.
A Pythonic Adventure: From Python basics to a working web app
A function is a callable unit of code that performs an operation and may accept arguments and return a result.
- How it is used
- Organizes repeated menu and order tasks into reusable pieces of a coffee-shop program.
- How deep it goes
- Works through defining, calling, passing arguments, returning values, defaults, and placeholder functions with complete Python examples.
- Examples
- Uses coffee-shop menus, a returned drink choice, main_menu(), get_order(), print_order(), save_order(), and a NameError repair.
- What you can do after
- Build it from scratch: define and call reusable Python functions that accept arguments and return menu or order results.
Read how A Pythonic Adventure: From Python basics to a working web app explains function →
F# in Action: A Revised Edition of Get Programming with F#
A function is a named or anonymous program construct that maps input values to a result and can encapsulate computation.
- How it is used
- Builds application behavior by transforming domain data and composing validation, conversion, and output steps.
- How deep it goes
- Explains declaration, inference, composition, currying, partial application, organization, and testing, while deferring generic types for later detail.
- Examples
- Uses greetings, even-number squaring, age descriptions, shopping baskets, ATM balances, and Arrange-Act-Assert tests.
- What you can do after
- Build it from scratch by defining small F# functions, composing them, partially applying inputs, and extracting testable calculations from output code.
Read how F# in Action: A Revised Edition of Get Programming with F# explains function →
Get Programming: Learn to code with Python
A helper function is a supporting function that performs a focused subtask for another function or larger program.
- How it is used
- Organizes a larger analysis into focused subtasks such as extracting unique area codes and mapping them to states.
- How deep it goes
- Works through nested helpers, their inputs, returned tuples, enclosing scope, and integration with a printing function.
- Examples
- Uses friends’ phone numbers to find unique area codes, look up states, and report the results.
- What you can do after
- Build it from scratch: split an analysis into helpers, test them individually, and combine them in a larger function.
Read how Get Programming: Learn to code with Python explains function →
Functional Programming in JavaScript
- How it is used
- Organizes JavaScript behavior into reusable, composable units for functional programming.
- How deep it goes
- Defines callable functions, then develops first-class use, higher-order calls, composition, side effects, and arity.
- Examples
- Uses DOM messages, array squaring, student display, arithmetic operations, counters, and string normalization pipelines.
- What you can do after
- Apply it via JavaScript functions to parameterize behavior, pass operations, return values, and combine focused transformations.
Read how Functional Programming in JavaScript explains function →
Python How-To
- How it is used
- Uses functions to reuse operations across an application and provide calls that teammates or package users can understand.
- How deep it goes
- Works through returns, signatures, variable arguments, first-class behavior, and testing, while recommending readable choices over unnecessarily complex functions.
- Examples
- Demonstrates urgency-based task sorting, dictionary-based action dispatch, an implicit `None` return, and an assertion for task creation.
- What you can do after
- Build it from scratch: define reusable Python functions with clear returns and signatures, then test their expected outputs.
Python Workout, Second Edition
A function is a callable program unit that encapsulates operations and can accept inputs and produce a result.
- How it is used
- Uses functions to organize repeated operations, compose transformations, and select behavior dynamically.
- How deep it goes
- Explains parameters, defaults, keyword arguments, higher-order use, and inner functions through executable problem-solving, without descending into runtime internals.
- Examples
- Demonstrates sorting records, counting distinct integers, analyzing files, generating passwords, calculating operators, and translating file contents.
- What you can do after
- Build it from scratch as reusable Python functions with clear arguments, returned results, optional behavior, and composable transformations.
The Quick Python Book, Fourth Edition
- How it is used
- Packages reusable tasks, from small calculations to text-processing steps and program control.
- How deep it goes
- Works through definitions, calls, argument forms, returns, docstrings, and first-class functions; defers full mixed-argument details to documentation.
- Examples
- Uses factorial, temperature conversion, word-count refactoring, and match-dependent text replacement.
- What you can do after
- Build it from scratch: define callable tasks, pass arguments, return results, and organize them into reusable program parts.
Read how The Quick Python Book, Fourth Edition explains function →
Learn Haskell by Example
A function is a program construct that computes a result from supplied inputs according to its definition.
- How it is used
- Introduces reusable Haskell transformations and later parameterizes recursive IO actions.
- How deep it goes
- Explains named and anonymous unary and binary definitions, function types, nested function results, and functions producing IO actions; defers monadic programming.
- Examples
- Uses square, add, and recursive interactiveLines for numbering entered lines.
- What you can do after
- Apply it via GHCi to define, type, and run simple named or anonymous Haskell functions.
Essential TypeScript 5, Third Edition
A JavaScript function is a callable construct that encapsulates executable code and can accept inputs and produce a result.
- How it is used
- Uses functions to organize JavaScript operations while showing how TypeScript checks assumptions about calls and results.
- How deep it goes
- Works through coercion, missing arguments, defaults, rest parameters, and TypeScript annotations; also introduces overloads and assert functions.
- Examples
- Demonstrates a price-summing function with mixed arguments and a utils.js module exporting discount and display functions.
- What you can do after
- Build it from scratch: define functions that handle argument counts and types deliberately, then annotate and check them with TypeScript.
Read how Essential TypeScript 5, Third Edition explains function →
Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
A function is a named, reusable block of PowerShell instructions that can be invoked as part of a script.
- How it is used
- Turns PowerShell instructions into single-task, reusable tools that controller scripts can combine.
- How deep it goes
- Explains parameters, pipeline output, scope, composition, and modular decomposition, while deferring more advanced parameter construction.
- Examples
- Uses service-logon automation, folder-size reporting, orphan-folder detection, and password-expiration notification functions.
- What you can do after
- Build it from scratch as a reusable PowerShell tool, place it in a script module, test it, and compose it into larger automation.
Julia as a Second Language
A function definition is a language construct that declares a function's name, arguments, and executable body.
- How it is used
- Uses functions to name reusable calculations and organize numeric, interactive, and text-processing tasks.
- How deep it goes
- Works through short and multiline definitions, final-expression results, method inspection, and chaining; defers the mathematical proof behind its sine example.
- Examples
- Builds sphere-volume and sine calculations, a multiplication-practice application, typed attack methods, and a chained text transformation.
- What you can do after
- Build it from scratch: define reusable Julia calculations and multiline tasks, then inspect methods or chain functions for larger applications.
Modern C
A function is a named C program unit that can be invoked to perform computation and optionally return a value.
- How it is used
- Packages reusable computations behind callable interfaces, including library operations and functions written for a program.
- How deep it goes
- Explains calls, prototypes, parameter and return types, void conventions, and per-call locals; treats pointer-mediated recursive state as a complication.
- Examples
- Uses printf output, a leap-year function, and a recursive function that passes nesting depth through a pointer.
- What you can do after
- Build it from scratch: define a reusable C function, declare its interface, and call it with appropriate arguments.
The Art of Code
A function is a callable program construct that accepts inputs and produces a result or effect according to its definition.
- How it is used
- Frames behavior as small input-to-output transformations for declarative, composable programming.
- How deep it goes
- Explains purity and Java functional interfaces, then develops lambdas and passing functions as values without detailing pipeline implementation.
- Examples
- Uses a string-length predicate, lambda replacements, cross-language lambda forms, and a raw-data pipeline illustration.
- What you can do after
- Apply it via Java functional interfaces and lambda expressions to define, store, return, and pass concise behavior.
Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu
A helper function is a reusable function that encapsulates a common operation for simpler use by other code.
- How it is used
- Transforms values for Terraform configuration and supplies reusable operations for provider tests.
- How deep it goes
- Defines call syntax and argument evaluation, then sketches provider function interfaces without walking through their implementation.
- Examples
- Shows startswith, split, and upper in locals, plus a helper that generates varied HCL configurations for resource tests.
- What you can do after
- Apply it via Terraform expressions to transform configuration values, or via Terratest helpers to reuse testing operations.
Read how Terraform in Depth: Infrastructure as Code with Terraform and OpenTofu explains function →
Modern C, Third Edition
A function is a named C program unit that can be called to perform an operation and optionally produce a value.
- How it is used
- Uses functions to modularize and factor code, delegate tasks, and provide reusable interfaces.
- How deep it goes
- Defines declarations, definitions, calls, returns, prototypes, local-variable copies, and recursion.
- Examples
- Uses main, printf, strlen, and Fibonacci variants as examples of entry points, library functions, recursion, caching, and iteration.
- What you can do after
- Apply functions by defining reusable features, calling them through prototypes, returning values, and reasoning about recursive calls.
The Well-Grounded Python Developer: How the pros use Python and Flask
A function is a named or callable program unit that performs an operation and can return a result.
- How it is used
- Uses functions as API boundaries for reusable operations and clearer application code.
- How deep it goes
- Explains naming, parameters, return values, single responsibility, testing, and refactoring, but stops short of language-runtime internals.
- Examples
- Uses community email name formatting and full-name construction to contrast conditional dispatch, parameters, printing, and returned values.
- What you can do after
- Apply single-responsibility design, return reusable results, choose parameters, and refactor functions that become difficult to understand.
Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains function →
Learn Rust in a Month of Lunches
A function is a named unit of executable code that can accept inputs and produce a result.
- How it is used
- Explains how Rust programs organize executable work, pass inputs, return values, and improve readability with helper functions.
- How deep it goes
- Defines syntax, arguments, return types, semicolon behavior, compiler feedback, and helper-function readability, but does not develop advanced function internals.
- Examples
- Uses `main`, `give_number`, typed multiplication, compiler diagnostics, helper functions, and asynchronous number-returning functions.
- What you can do after
- Build it from scratch by declaring Rust functions, supplying typed arguments, returning values, and correcting semicolon-related compiler errors.
Read how Learn Rust in a Month of Lunches explains function →
How Computers Make Books
A function is a named computational unit that accepts parameters, performs operations, and can return a result.
- How it is used
- Builds larger programs from named, reusable calculations and smaller algorithmic parts.
- How deep it goes
- Defines parameters, operations, conditions, and return values, then demonstrates recursive evaluation without presenting language-specific implementation details.
- Examples
- Uses a recursive power calculation and a text-search algorithm whose compare function returns true or false.
- What you can do after
- Build it from scratch by defining reusable functions with parameters, conditional logic, recursive calls, and returned results.
The Well-Grounded Rubyist, Fourth Edition
A function is a callable computation that can be passed as a value or returned as a value in a functional programming style.
- How it is used
- Uses functions to pass transformations into methods, return reusable computations, and construct specialized behavior through currying.
- How deep it goes
- Explains blocks, procs, arity, partial application, and currying with runnable examples, while stopping short of implementation internals.
- Examples
- Demonstrates map transformations, returned multiplier procs, curried addition, and generic functions selecting array multiples.
- What you can do after
- Apply it via Ruby blocks, Proc objects, lambdas, and curry to pass transformations or build reusable specialized functions.
Read how The Well-Grounded Rubyist, Fourth Edition explains function →
Deep Learning with PyTorch, Second Edition
A mathematical mapping from inputs to outputs, used here as the target of approximation by learning systems.
- How it is used
- Frames machine learning as automatically fitting parameterized functions to data.
- How deep it goes
- Defines functions through models and parameters, but defers derivative mechanics to later treatment.
- Examples
- Uses Kepler’s ellipse, observed trajectories, and neural networks as contrasting function-fitting examples.
- What you can do after
- Understand how learning systems approximate task-specific functions by estimating parameters from data.
Read how Deep Learning with PyTorch, Second Edition explains function →
Related concepts
- lambdaincludes · A lambda is a language construct that defines an unnamed function or callable, often as a value.
- methodincludes · A method is a callable operation associated with an object or type and invoked through that association.
- modulepart of · A module is a distinct, bounded software unit that groups related code or functionality and provides an organizational or interaction boundary within a larger system.
- closureincludes · A closure is a function or callable value together with access to bindings from the lexical environment in which it was created.
- generatorincludes · A generator is a language construct or computation that produces values incrementally on demand, typically suspending and resuming while preserving its state.
- data transformationused by · A data transformation is an operation or function that maps input data or its representation to modified data or a different representation.
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.



















