An argument in programming is the actual value you hand to a function when you call it, so the function has something concrete to work on. If a function is a small machine that takes input, does a job, and gives back a result, the arguments are the inputs you feed in at the moment you press start. A function that adds two numbers needs two arguments, the two numbers, supplied when you call it. The word is often confused with parameter, but they are not the same, and clearing that up is half the battle. Here is what an argument is and how it flows into a function.
How an argument works
When you define a function, you list the inputs it expects. When you call the function, you supply real values for those inputs, and those supplied values are the arguments. The function receives them, runs its instructions using them, and usually returns something.
Picture a vending machine. The slot where you insert money is the parameter, the placeholder the machine is built to accept. The actual coins you push in are the arguments. The machine cannot make a snack until you provide real coins, just as a function cannot do its job until you pass real arguments.
If functions themselves are still new, our explainer on how to write a function shows how they are built before you start feeding them values.
Argument vs parameter
This is the distinction that trips up nearly everyone at the start, so it is worth stating plainly. A parameter is the named placeholder in the function definition. An argument is the concrete value you pass in when you call the function. Same slot, different stages.
| Term |
When it appears |
What it is |
| Parameter |
In the function definition |
A named placeholder for an expected input |
| Argument |
At the call site |
The actual value supplied for that placeholder |
So in a definition the inputs are parameters, and at the call the values you provide are arguments. Many people use the words loosely, but knowing the difference makes documentation far easier to read. Our guide to what a parameter is goes deeper on the placeholder side.
How arguments line up
- Order matters by default. The first argument fills the first parameter, the second fills the second, and so on. Swapping them silently changes the meaning.
- Some languages allow named arguments, letting you say which parameter each value is for, which improves readability.
- Some parameters have defaults, so you can leave out the matching argument and the function uses a fallback value.
- A function may take zero arguments, doing its whole job with no input, or many, depending on the task.
Getting the count and order right is essential. Too few arguments, too many, or the wrong order is a frequent source of bugs and error messages.
Common mistakes
- Passing arguments in the wrong order. The function still runs but uses your values for the wrong purposes.
- Supplying the wrong number. Most languages complain if the count does not match what the function expects.
- Confusing the names. A parameter is defined; an argument is passed. Mixing them up muddles your reading of docs.
- Passing the wrong type. Handing text where a number is expected often triggers an error or odd behavior.
FAQ
What is the difference between an argument and a parameter?
A parameter is the named placeholder in the function definition; an argument is the actual value you pass when you call the function.
Can a function have no arguments?
Yes. Some functions do their entire job without any input, so you call them with empty parentheses and pass nothing.
Does the order of arguments matter?
Usually yes. By default the first argument fills the first parameter and so on, so swapping them changes what the function does. Some languages let you name arguments to avoid this.
What happens if I pass the wrong number of arguments?
Most languages raise an error if the count does not match, though some allow defaults or flexible counts. Match what the function expects to be safe.
Where to go next
Learn the placeholder side in What Is a Parameter in 2026, build the functions themselves with How to Write a Function in 2026, and ground your basics in What Is a Data Type in 2026.