Programmers use the terms argument and parameter interchangeably. When someone says argument or parameter, they mean the same thing. However, there is a difference.
Parameter Vs. Argument
Parameter
- Named variables declared in the function definition
- Part of the function/method signature
- In some programming languages, parameters are also called formal arguments
Argument
- Variables or values passed to the function when called
- The actual value supplied to the function at runtime
- In some programming languages, arguments are also called actual arguments
Parameters are named variables declared in the function definition.
Arguments are variables or values passed to the function when calling it.
This definition is universal, irrespective of programming language. Let us consider the following Python function:
def multiply(x, y): return x * y; multiply(10, 15);
In the above example, the function multiple()
expects two parameters: x and y
. Next, when the function multiply()
is called, two arguments are passed to the function: 10 and 15
. Therefore, arguments are runtime values that fill the function parameters.
Join our list to get instant access to new articles and weekly newsletter.