Parameter (computer programming)

In computer science, parameters are stored names of information that we want to use for a subroutine.[1] These pieces of information, called values, are then passed on to the subroutine to be used as arguments.[1] Then these arguments can affect how the program will run.[2]

Parameter (programming)

For example, in the following Python function:


def greet(name):

print("Hello, " + name + "!")


The word name is a parameter. When the function is called with a value (like "Alice"), the parameter name will hold that value and the function will use it to perform its action:


greet("Alice") # Outputs: Hello, Alice!


In this case, the parameter allows the function to personalize the greeting by using the value provided during the function call.

References