Parameters
Explain function parameters, their syntax, and default parameters in detail.
We'll cover the following
Parameters syntax
Parameters are how data is passed between functions through the call of the function.
We learned earlier that we list the data we want to pass to a function in the call between the ( )
. The order of the list is determined by the function definition. The first parameter in the list will be assigned to the variable listed first in the function definition.
Note: In most cases, you must have the correct number and type of data being passed to the function or you will receive an error when you try to compile your program.
Let’s take a look at an example below:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy