![]() ![]() |
Conceptual Review (page 51 of 55) |
A parameter is a variable which we use in the function definition. It is a “handle” that allows the code in the function to access the arguments that get passed when the function is called.
In the below example, num1 is the parameter in our fruitful function named absolute_value. We do not have to specify the data type of our parameters when defining them, which is similar to variable assignment in Python. Due to not defining the data types of the parameters, we must be careful when designing our function. What do we want to happen if the user (calling statement) passes a string instead of a number? Do we wnat to throw a traceback error or something else? It is the designers job to figure out these different options and code the function accordingly.
