EngTW / English-for-Programmers

《程式英文》:用英文提昇程式可讀性
977 stars 45 forks source link

參數: argument vs. parameter 有什麼不一樣? #31

Closed twy30 closed 4 years ago

twy30 commented 4 years ago

https://github.com/EngTW/English-for-Programmers/issues/25#issuecomment-664709204

同樣的也讓我想到argument和parameter的關係

FongX777 commented 4 years ago

之前有做過筆記:

Parameters: 參數 Arguments: 引數

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. Parameter is variable in the declaration of function. Argument is the actual value of this variable that gets passed to function.

Parameters are used to define a function. They are also called formal parameters and formal arguments.

function foo(param1, param2) {
    ...
}

param1 and param2 are parameters

Arguments are used to invoke a function. They are also called actual parameters and actual arguments. foo(3, 7) 3 and 7 are arguments:

--

參考:function - "Parameter" vs "Argument" - Stack Overflow

twy30 commented 4 years ago

補充一點資料 😊

late 1920s when it began to be extended to "measurable factor which helps to define a particular system,"

parameter 在 1920 年代晚期開始含有「用來定義一系統的『可測量因子』」


洋鄉民討論「為什麼引數要叫 "argument" ?」;有人從語源學的角度回答,大意是:

https://www.etymonline.com/word/argument#etymonline_v_26509 from arguere "make clear, make known, prove"

twy30 commented 4 years ago

已整理至 https://github.com/EngTW/English-for-Programmers/blob/master/notes/2020-08-21-validate-verify.md

twy30 commented 4 years ago

如果覺得還有問題、疑慮,歡迎再開新 issue 來討論 😊