Skip to content
BENIBIX Learn

Parameter

Development🧩 Programming ConceptsFunctions

Also known as Function Parameter

A name in a function. It holds the value the function is given later.

Think of it like

Think of it like a blank line on a form. The form says Name, and each person writes their own.

Example

The function area(width, height) has two parameters. Called with 3 and 4, width is 3 and height is 4.

Why it matters

They let one function work on many values. Without them, each number would need its own function.

Definition

A parameter is a name in a function that stands for a value it will be given. It is written in the brackets when the function is made, like width and height. Inside the function, the parameter works like a variable. Each time the function is called, the parameter holds whatever value was passed in. A function can have none, one or many.

Example code

python
def area(width, height):
    return width * height

print(area(3, 4))   # 12
Width and height are the blanks. The call fills them with 3 and 4.

Common mistake

Mixing up the blank and the value. The parameter is the blank. The argument fills it.

Key takeaways

  1. 1
    A named blank. It waits for a value from the call.
  2. 2
    Set by position. The first value fills the first name.
  3. 3
    Lives inside. It only exists within its function.

Compare

Learn it properly