+ 1

What is the difference between Parameters and Arguments?

please explain by differentiating between 2 points

16th Oct 2016, 6:35 PM
M R Mallick
M R Mallick - avatar
9 Réponses
+ 7
Actually SoloLearn says in one course the name of the variables in a function, like Def do_Something (x,y) are called Parameters. However the Values sent by calling that function as in Print do_Something (3,5) are called arguments. The word "parameter" also has to do with boundaries and the ability to do work as in the phrase "operating parameters", so the variables x and y above in the function definition are the boundaries the formula will be bound by, therefore they are parameters. The word "argument" can mean "to make a (single) case for something or a position on something" so since you call a function and pass it values asking the function "what happens in this case" we call those values "arguments".
16th Oct 2016, 11:05 PM
DevCoder (John Sullivan)
DevCoder (John Sullivan) - avatar
+ 3
@Ousmane: Dang, I've just checked and you seem to be right. Don't I look like a fool after firmly affirming something wrong twice? At least I've learned something new today. xD
16th Oct 2016, 11:48 PM
Zen
Zen - avatar
+ 3
@Zen, by the way I wasn't trying to be harsh, just explain. We are all here to learn and sometimes we do just express things differently. Your response shows great maturity which is a good trait. :)
17th Oct 2016, 1:21 AM
DevCoder (John Sullivan)
DevCoder (John Sullivan) - avatar
+ 2
They are synonymous. Edit: I was wrong, see Ousmane's post.
16th Oct 2016, 6:49 PM
Zen
Zen - avatar
+ 2
I will say it again, they are synonymous. Edit: I was wrong, see Ousmane's post.
16th Oct 2016, 8:23 PM
Zen
Zen - avatar
+ 2
Well technically speaking they are a little different. Programmers seem to take it for granted interchanging these two words freely and ofcourse there is no problem to it. The true definition of parameter and argument: public static void Method(int x){ // do some magic :) } The above "int x" is known as a parameter. The below code with the number "4" is known as an argument. Method(4); // invoking the method Finally doesnt really matter what word you use as long as you know what you're doing.
16th Oct 2016, 9:15 PM
Ousmane Diaw
+ 2
Zen, its cool we can all learn from eachother! I believe that's part of being good programmer.
16th Oct 2016, 11:58 PM
Ousmane Diaw
+ 1
You are correct M R Mallick. Perhaps to some they are shades of meaning but they are very different words and just because people sometimes treat them as the same doesn't make it so. Example: some people call something "cool" but don't refer to it's temperature and in some places they say "wicked" which certainly is not related to temperature either but they essentially mean "cool" as well in most contexts when not directly referring to something evil. But to say that cool and wicked as bare definitions are the same would be incorrect. Improper use by ignorant or uncaring or fashionable or current culture doesn't mean that different things are actually the same, unless people on the whole don't say anything to contradict it then it can become the norm. In this case I can see people wanting to use them the same but it would be much clearer if we did not and were consistent in our usage.
16th Oct 2016, 11:13 PM
DevCoder (John Sullivan)
DevCoder (John Sullivan) - avatar
0
nah... there must be a slight difference between them
16th Oct 2016, 6:55 PM
M R Mallick
M R Mallick - avatar