zoukankan      html  css  js  c++  java
  • Parameter和Argument的区别

    在程序世界中,我们经常会用到两个词条来标识变量,即Parameter和Argument。那么,现在的问题是,这两者有什么区别呢?

    通常我们认为,parameter是参数,而argument是参数的值。对应的中文术语是:parameter = 形参;argument = 实参。

    What is the difference between an argument and a parameter?
    >> While defining method, variables passed in the method are called parameters.
    >> While using those methods, values passed to those variables are called arguments. 

    当我们定义一个方法的时候,传入变量的名字就是Parameter。我们来看一个例子:

    function GetSquareArea(sideLength)
     {
     return sideLength*sideLength;
     }
    

     这里,sideLength就是Parameter。

    当我们在调用这个方法的时候,值会传给变量,这个变量就叫Argument。例如:

    var intSideLength = 4;
    var intSquareArea = GetSquareArea(intSideLength);
    

    程序运行的时候,intSideLength会被赋值为4,那么对于方法GetSquareArea的调用,intSideLength就是Argument。

  • 相关阅读:
    初涉网络安全领域
    pythontip上的数据结构和算法练习题
    学c++需要先学c语言吗?
    田园将芜胡不归
    java学习视频
    微软越来越喜欢Github(转载)
    指针(一级指针、二级指针)
    数字盒子
    点结构Tpoint
    枚举类型
  • 原文地址:https://www.cnblogs.com/urwlcm/p/1402180.html
Copyright © 2011-2022 走看看