Default parameters are parameters which are given by default while declaring a function. But it’s value can be changed when calling the function.
Consider another example:
In the above example, the function takes two parameters and the second parameter replaces the default parameter.
Consider another example:
When you are calling the function with parameters they get assigned in the order. (i.e) the first value gets assigned to the first parameter and the second value gets assign to the second parameter and so on..
In the above example, the value 20 gets assigned to parameter ‘a’ and ‘b’ is not having any value. So we are not getting any output.
But,