+ 1

Differences between parameter & argument? Please.

What is the differences between both?

6th Jan 2018, 7:45 AM
Antonio Oliver
Antonio Oliver - avatar
4 Antworten
+ 14
Parameters are the values that a function asks for. Ex: def example(x, y) #Wants/has 2 parameters, x and y. Arguments are the values themselves, that are sent to a function. example(17, 15) #Sends 2 arguments, 17 and 15.
6th Jan 2018, 7:59 AM
Tamra
Tamra - avatar
+ 12
Parameter is variable in the declaration of function/method Argument is the actual value of this variable that gets passed to function/method https://stackoverflow.com/a/156787
6th Jan 2018, 7:59 AM
Hannah Grace
Hannah Grace - avatar
+ 6
void func(int a){} - a is parameter func(5) - when call func , 5 is argument
6th Jan 2018, 8:19 AM
Hasan Jafarov
Hasan Jafarov - avatar
+ 5
function Hello(a,b) { alert(a+b);} a and b are the parameters for the function,they have no values yet. Hello(5,8); 5 and 8 serve as values for a,b they are arguments //output 5+8==13
6th Jan 2018, 8:11 AM
᠌᠌Code X
᠌᠌Code X - avatar