QamoosTech
Programming FundamentalsFunctions and scopeBeginner

Parameter vs Argument

Pronunciationpuh-RAM-ih-ter versus AR-gyuh-ment

Definition

A parameter is the name in the function definition. An argument is the real value you pass when you call it.

Where you hear it

Code reviews, documentation, and error messages such as "expected 2 arguments, got 1".

Examples

  • The function takes two parameters: name and age.
  • You passed three arguments, but it expects two.
  • The parameter is total; the argument is the 250 that the caller passes in.

Common mistake

Using the two words as if they were identical. People usually understand you, but in interviews the difference is a common question.

Say it at work

  • In a meeting or chatMake sure the argument you're passing matches the type defined in the function parameter.
  • In an email or ticketI noticed a mismatch between the function parameters and the arguments provided in the service call.