Computer Science Atlas
Concepts

Function Parameter vs. Argument

February 2, 2021
 

When talking about functions, the words "parameter" and "argument" may appear at first to be interchangeable. However, for many programming languages, the words actually refer to two different things. In short:

For example, if we have the following function definition in JavaScript:

JavaScript
/*  Parameters: a, b  */
function add( a, b ) {
    return a + b
}
1
2
3
4
/*  Parameters: a, b  */
function add( a, b ) {
    return a + b
}

a and b are parameters of the function add.

If we then call the function:

JavaScript
/*  Arguments: 2, 3  */
let sum = add( 2, 3 )
1
2
/*  Arguments: 2, 3  */
let sum = add( 2, 3 )

2 and 3 are arguments of the add( 2, 3 ) function call statement. The argument 2 satisfies parameter a, and argument 3 satisfies parameter b.

Reference

Many popular programming languages today derive their usage of the terms from earlier sources like: