Pages

Tuesday, September 13, 2016

Parameter or argument?

The closely related words parameter and argument are sometimes carelessly used interchangeably. This probably won't cause the end of the world. But it is a mistake, since the two words have distinct meanings. According to Donald Knuth:
When a subroutine is written to handle a general case, it is often written in terms of parameters, values which govern the subroutine's action, but which are subject to change from one call of the subroutine to another.

The coding in the outside program which transfers control to the subroutine and gets it properly started is known as the “calling sequence.” Particular values of parameters, supplied when the subroutine is called, are known as arguments. (Knuth 183)

Work Cited

Knuth, Donald. The Art of Computer Programming. vol. 1, 2nd ed., Addison-Wesley, 1973.