DEV Community

Samuel Amagbakhen
Samuel Amagbakhen

Posted on • Edited on

Parameters and Arguments..the difference

Hello, Developers...

So, I remembered a definition I struggled with back then in CS class and I decided to differentiate so others could learn from it.

What is the difference between

Parameters and Arguments?

A lot of devs use these terms interchangeably, it's really no big deal if you're writing codes but when documenting, you want to make sure you're passing the right information across to whoever's reading your article.

  1. Parameters are named variables which are declared during a function's definition.

  2. Arguments are the real values passed into the functions.

Alt Text

As you see in the example above, the parameter in the function is the name variable passed in during the function definition while the argument is the name Samuel passed in during function invocation.

You can use this link as a reference to understand better.

Top comments (6)

Collapse
 
pentacular profile image
pentacular

I think you're still a bit off. :)

Arguments are the values passed to the call.

Parameters are the variables those values are bound to in the body of the callee.

It doesn't make sense to talk about passing variables in a language with pass-by-value semantics.

Collapse
 
samuelorobosa profile image
Samuel Amagbakhen

Actually no difference in what I explained and what you said unless you see something I don't.

Collapse
 
pentacular profile image
pentacular • Edited

Parameters are variables passed into a function

Here :)

Thread Thread
 
samuelorobosa profile image
Samuel Amagbakhen

Okay now, I understand you.

Rather than passed, they are bound to the function. I'll edit the post.

Thanks for clarifying that.

Thread Thread
 
pentacular profile image
pentacular

Rather than bound to the function, the argument values are bound to the corresponding parameter variables in the body of the function. :)

Thread Thread
 
samuelorobosa profile image
Samuel Amagbakhen

Okay, noted.