You’ll definitely hear the words parameter and argument during your coding journey. In some cases, you may hear them being used interchangeably, however, they are different but closely related.

Let’s use an example to get a better understanding of parameter and argument.

When you are declaring a function, you will state the parameters required for it to work.

def multiply(x, y)
  x * y

# x and y are the parameters

In the above example, we created a function that has two parameters, x and y. A parameter is what is required to make the function work when it is declared

An argument is what is actually passed to the function when it is being called.


# 2 and 3 are the arguments
# output 6 

When we use a function and pass in data, then it is called an argument. So we passed two arguments to the multiply function.

I hope this helps clarify the use of these two terms.

This post is also available on DEV.