What are the difference between Parameter and Argument?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mohammed Alamgir Hosen
    New Member
    • Jan 2010
    • 1

    What are the difference between Parameter and Argument?

    Hello

    It is my first question to you. I have a little confuse about the different between Parameter and Argument.
    I will very glad if you help me in this occasion..

    Yuor's ever
    Alamgir
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Usually "Parameter” and “Argument” are used interchangeably to refer to the variables that you use to define and pass into a method.

    A "parameter" is the definition of the variable that is used to pass data into a method (a sub/function).

    For example, "param" is being defined in this statement as a "parameter" for the exampleFunction :
    Code:
    Function exampleFunction( ByVal param As String) As String

    When using the exampleFunction , the data passed into the exampleFunction as "param" is referred to as the "argument". For example:
    Code:
    String arg = "The argument"
    String result = exampleFunction(arg)
    The variable "arg" is the is initialized with data at run time and is passed to the exampleFunction method. That piece of data passed into the exampleFunction is the argument.

    In other words, an "argument" is the piece of data that is passed into the function.

    Like I said, the words are interchangeable and other developers will understand what you mean from the context. Usually people don't have to think about these things.

    See wikipedia's article on Parameters for a much better explanation than mine.

    -Frinny

    Comment

    Working...