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

后端 未结 30 1867
北恋
北恋 2020-11-22 01:08

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

相关标签:
30条回答
  • 2020-11-22 01:50

    Or even simpler...

    Arguments in !

    Parameters out !

    0 讨论(0)
  • 2020-11-22 01:53

    Simple:

    • PARAMETER → PLACEHOLDER (This means a placeholder belongs to the function naming and be used in the function body)
    • ARGUMENT → ACTUAL VALUE (This means an actual value which is passed by the function calling)
    0 讨论(0)
  • 2020-11-22 01:53

    An argument is an instantiation of a parameter.

    0 讨论(0)
  • 2020-11-22 01:54

    Always Remember that:- Arguments are passed while parameters are recieved.

    0 讨论(0)
  • 2020-11-22 01:56

    The terms are somewhat interchangeable. The distinction described in other answers is more properly expressed with the terms formal parameter for the name used inside the body of the function and parameter for the value supplied at the call site (formal argument and argument are also common).

    Also note that, in mathematics, the term argument is far more common and parameter usually means something quite different (though the parameter in a parametric equation is essentially the argument to two or more functions).

    0 讨论(0)
  • 2020-11-22 01:56

    Logically speaking,we're actually talking about the same thing. But I think a simple metaphor would be helpful to solve this dilemma.

    If the metaphors can be called various connection point we can equate them to plug points on a wall. In this case we can consider parameters and arguments as follows;

    Parameters are the sockets of the plug-point which may take various different shapes. But only certain types of plugs fit them.
    Arguments will be the actual plugs that would be plugged into the plug points/sockets to activate certain equipments.

    0 讨论(0)
提交回复
热议问题