“parameters” vs “arguments”

I have been confused and used the wrong term too, so here it is:

An important note: you’ve probably heard the terms “parameters” and “arguments” used interchangeably. Then why is this type called Parameters and not Arguments? The reason is that the two words have different meanings when we talk about programming languages in a formal way.

A parameter is part of a function’s definition, like the n in function double(n: number). An argument is a value that we pass when calling a function, like the 5 in double(5). Many programmers call both of these “arguments” in everyday conversation. Compilers and other programming language tools like TypeScript need to avoid ambiguity, so they usually distinguish between parameters and arguments.

https://www.executeprogram.com/courses/everyday-typescript/lessons/returntype-and-parameters

Leave a comment