liveBook · Manning

Function declaration

A function declaration is a source-language construct that specifies a function’s name and parameter interface, and may include its implementation.

How 6 Manning books explain it

Secrets of the JavaScript Ninja, Second Edition

A JavaScript statement that defines a named function.

How it is used
Defines named JavaScript functions as standalone statements, distinguishing them from function expressions when deciding where a function is available for invocation.
How deep it goes
Explains required syntax, nesting, and early identifier registration in lexical environments, while deferring detailed scope and identifier resolution.
Examples
Compares nested declarations with function expressions and tests access to a function before its declaration executes.
What you can do after
Build it from scratch as a named statement and predict when calls before its declaration work in global or function environments.

Read how Secrets of the JavaScript Ninja, Second Edition explains function declaration →

A Pythonic Adventure: From Python basics to a working web app

A function definition is a Python statement that declares a function's name, arguments, and indented body.

How it is used
Defines reusable menu behavior so one operation can serve drinks, flavors, and toppings.
How deep it goes
Explains def syntax, arguments, indentation, return values, default arguments, and calls through a menu program.
Examples
Uses a coffee-shop menu with drink, flavor, and topping lists, including interactive selections and printed orders.
What you can do after
Build it from scratch: declare a menu function, call it with different lists, and return each selected item.

Read how A Pythonic Adventure: From Python basics to a working web app explains function declaration →

Modern C

A function declaration is a C declaration that specifies a function's name, parameter interface, and return type without necessarily defining its body.

How it is used
Identifies a function and its interface before distinguishing that declaration from its definition and calls.
How deep it goes
Defines the distinction through `main` and its braced body, while deferring complications in the declaration–definition relationship.
Examples
Uses `int main(void)` followed by a braced body and contrasts it with a call to `printf`.
What you can do after
Evaluate/understand whether a function is merely declared or also defined by checking for its braced body.

Read how Modern C explains function declaration →

Get Programming: Learn to code with Python

A function definition is a Python construct that declares a function's name, parameters, and executable code block.

How it is used
Defines reusable Python modules that accept values, perform an action, and return a value.
How deep it goes
Explains syntax, indentation, docstrings, calls, returns, and function scope, but stops short of deeper implementation details.
Examples
Uses attendance checking, string concatenation, quick-check definitions, and a tip-calculation exercise.
What you can do after
Build it from scratch by defining functions, documenting them, calling them with values, and using returned results.

Read how Get Programming: Learn to code with Python explains function declaration →

Modern C, Third Edition

A function definition is a C construct that specifies a function's declaration and body.

How it is used
Distinguishes function declarations from definitions and identifies main as the starting point of program execution.
How deep it goes
Explains the distinction through declarations, return types, parameter lists, function bodies, and enclosing braces.
Examples
Uses main(void) and main with argc and argv to show declarations followed by executable function bodies.
What you can do after
Evaluate whether a function name has only a declaration or a complete definition containing a body.

Read how Modern C, Third Edition explains function declaration →

Learn AI-Assisted Python Programming, Second Edition

How it is used
Uses function declarations to organize reusable input-processing-output tasks and prompt Copilot to generate Python code.
How deep it goes
Explains function headers through their keyword, name, inputs, colon, body, and returned output.
Examples
Uses a larger function that compares two numbers, alongside the mathematical example f(x) = x².
What you can do after
Build it from scratch by writing a Python function header, defining its body, and returning a result.

Read how Learn AI-Assisted Python Programming, Second Edition explains function declaration →

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.