A parameter is a named placeholder in a function definition that stands in for a value the function will receive when it runs. Think of it as a labeled slot: when you write the function you name the slot, and when you call the function you fill the slot with a real value. Parameters are what make a function reusable, because one definition can work on whatever values you hand it. The word is often confused with argument, but they sit on opposite ends of the same handoff, which we will untangle below.
What a parameter actually is
When you define a function, the names in the parentheses are parameters. They do not hold real data yet; they are promises that a value will arrive when the function is called.
In the example below, name and greeting are parameters. They exist only inside the function definition and describe what the function expects.
-- name and greeting are parameters in this definition
def greet(name, greeting):
return greeting + ", " + name
When you later write greet("Sam", "Hello"), the strings "Sam" and "Hello" are the arguments, and they get bound to the parameters in order.
Parameter vs argument
This is the distinction that trips up most beginners, so it is worth being precise.
| Term |
Where it lives |
What it is |
| Parameter |
In the function definition |
A named placeholder for an incoming value |
| Argument |
At the call site |
The actual value passed in |
A clean way to remember it: parameters are the empty boxes you draw when designing the function; arguments are what you drop into those boxes when you use it. The same value is an argument when you pass it and lands in a parameter when it arrives. Many languages also let you declare what data type each parameter expects.
Common kinds of parameters
| Kind |
What it does |
Example call |
| Positional |
Matched by order |
greet("Sam", "Hi") |
| Named (keyword) |
Matched by name |
greet(greeting="Hi", name="Sam") |
| Default |
Has a fallback value |
greet("Sam") uses a preset greeting |
| Variadic |
Accepts any number of values |
sum(1, 2, 3, 4) |
Positional parameters are filled by order, which is fine for one or two inputs. Named parameters let the caller be explicit, which helps readability when a function has many inputs. Default values let a caller skip an optional parameter entirely. Languages differ in which of these they support, but the ideas carry across nearly all of them.
How to use parameters well
- Keep the count low. A function with seven positional parameters is hard to call correctly. Group related ones into an object if you must.
- Order by importance. Required inputs first, optional ones with defaults last.
- Name them clearly.
radius beats r; the parameter name is documentation.
- Use defaults for sensible fallbacks. Do not force callers to pass values they rarely change.
- Prefer named arguments at the call site for booleans.
archive(user, notify=False) reads better than archive(user, False).
Common mistakes
- Confusing the two terms in conversation. Mixing up parameter and argument leads to muddled code reviews; keep them straight.
- Mutable default values. In some languages a default like an empty list is shared across calls and causes subtle bugs. Use a safe sentinel instead.
- Too many positional parameters. Past three or four, order becomes a guessing game. Switch to named parameters or a config object.
- Shadowing. Naming a parameter the same as an outer variable hides the outer one and confuses readers.
FAQ
Is a parameter the same as an argument?
No. A parameter is the named placeholder in the definition; an argument is the real value you pass when calling. The argument fills the parameter.
Can a function have no parameters?
Yes. A function can take zero parameters and simply do its work with no external input, like one that returns the current time.
What is a default parameter?
A parameter that has a preset value used when the caller does not supply one, so the input becomes optional.
Are parameters the same in every language?
The core idea is universal, but support for defaults, named arguments, and variadic parameters varies. Check your language for the exact rules.
Where to go next
See what an argument is in 2026, how to write a function in 2026, and what a method is in 2026.