Search code examples
parameterslanguage-agnosticargumentsterminology

What's the difference between an argument and a parameter?


When verbally talking about methods, I'm never sure whether to use the word argument or parameter or something else. Either way the other people know what I mean, but what's correct, and what's the history of the terms?

I'm a C# programmer, but I also wonder whether people use different terms in different languages.

For the record I'm self-taught without a background in Computer Science. (Please don't tell me to read Code Complete because I'm asking this for the benefit of other people who don't already have a copy of Steve McConnell's marvelous book.)


Solution

  • A parameter is a variable in a method definition. When a method is called, the arguments are the data you pass into the method's parameters.

    public void MyMethod(string myParam) { }
    
    ...
    
    string myArg1 = "this is my argument";
    myClass.MyMethod(myArg1);