Skip to content
Derek Lewis edited this page Nov 1, 2022 · 1 revision

A programmer can influence a function's behavior via an input.

  • A parameter is a function input specified in a function definition. Ex: A pizza area function might have diameter as an input.
  • An argument is a value provided to a function's parameter during a function call. Ex: A pizza area function might be called as calc_pizza_area(12.0) or as calc_pizza_area(16.0).

A parameter is like a variable definition. Upon entering the function, the parameter is bound to the argument object provided by the call, creating a shared reference to the object. Upon return, the parameter can no longer be used.

An argument may be an expression, like 12.0, x, or x * 1.5.

Clone this wiki locally