Parameter vs Argument

ParameterVSArgument

What’s in a name? I hear people talking about, or more likely arguing over, whether it’s a bracket or a brace; whether it’s a method or a function; whether it’s a parameter or an argument… And, frankly, most people seem to get it wrong.

In the case of Argument vs. Parameter, after doing an infinitesimally small amount of research, I found this post (from which I shamelessly nicked the image for this entry…):

http://stackoverflow.com/questions/1788923/parameter-vs-argument

Primarily, it boils down to what is mentioned in one of the comments:

  • Argument is the value/variable/reference being passed in.
  • Parameter is the receiving variable used in the function’s signature.

or, as per the response which featured the code snippet above:

void Foo(int i, float f)
{
    // Do things
}

void Bar()
{
    int anInt = 1;
    Foo(anInt, 2.0);
}

  • Here i and f are the parameters, and anInt and 2.0 are the arguments.

[All cleanup, paraphrasing and emphasis are mine…]

The smallest amount of additional research seem to back this up, where wikipedia says:

  • These two terms parameter and argument are sometimes loosely used interchangeably, and the context is used to distinguish the meaning. The term parameter (sometimes called formal parameter) is often used to refer to the variable as found in the function definition, while argument (sometimes called actual parameter) refers to the actual value passed. To avoid confusion, it is common to view a parameter as a variable, and an argument as a value.

2 Comments

Steven Castle

about 10 years ago Reply

Hi Mate, Im reading up on Generated Level Design and was wondering if you'd be willing to share your Unity project with me? You're blog has already been a great help and the way you layout both wins and losses is fantastic and really helps! I'd really apprieciate anything you could pass on. Cheers Steve

Adam

about 10 years ago Reply

Whoops! You seem to have added this to the wrong post, but that's OK. Currently my project is not in a state to share. It's very rough. All of the functionality is described in the two blog posts. In general, you should be able to recreate this in your own project. If you are having trouble getting anything to work, just reply to the post (the correct one!) and I'll try to give you a hand.

Leave a Comment

Leave a Reply to Steven Castle Cancel Reply

Please be polite. We appreciate that. Your email address will not be published and the required fields are marked.