The difference between Parameters and Arguments

Nikhil K Mannem
3 min readDec 10, 2020

And why it matters

Photo by Tobias Tullius on Unsplash

One of the very common misconceptions that people tend to have(or at least, I did) in Programming is about the idea of a Parameter and an Argument.

Ever since I started to look at the already developed code in the Books and/or Online Tutorials, I looked at the functions and exclaimed at what they could do in a program: the way they

  • communicate with each other,
  • compose each other
  • call each other

making the program cohesive, optimally!

But, how about that communication across the functions in a program? How does that happen? Well, that’s where the arguments step in. They are passed to the functions (or methods) for the execution of the desired operation, may it be communication across or procedure within.

The terms Argument and Parameter may have different meanings in different programming languages. Interchangeably they are used, depending on the context! Although there is, conceptually, an idea to separate them, which makes sense, to be understood and practiced, so that the next time you (we, actually) come across a state of bewilderment regarding what to call each, you will have an adamantine idea yourself.

Well, let’s now know the brief and essential divergence factor:

Parameter is the one used to refer to the variable that’s used in the function definition: assigning a parameter to the function as a formal parameter means that it has just a nominal value (only the name, no evaluated value: declared right inside the parenthesis) which goes through the function body to perform the intended task and be returned (in the end, or after a certain condition is met).
As the above reads, a parameter is actually called a formal parameter.

// Parameters in the function definiton of the 'functionAdd'
function functionAdd(parameter1, parameter2) {
return parameter1 + parameter2
}

Argument is the one used to refer to the actual value that will be passed to the function at the time of its execution, aka, the function call: while parameters can only be nominal variables that are native to the function definition, arguments passed can be literal(s) (literal values such as 5 (Integer Literal), “Hello World” (String Literal)), variable(s) or also a complex expression composing both literal(s) and variable(s).
The argument is called an actual parameter.

// Arguments passed into the 'functionAdd' when it's called
functionAdd(4, 5)
// Also pass variables as arguments
let x = 4, y = 5
functionAdd(x, y)

I hope this suffices for a basic understanding of the difference between a Parameter and an Argument. Any doubts from your end could be happily received and I’ll try my best to clarify them or anyone in possession of the knowledge are gladly welcome: kindly drop a comment in that case!

Thank you :)

--

--