Previous Up Next

10.1.4  Default values of the parameters

You can give the parameters of a function default values by putting parameter=value in the parameter list of the function. For example, if you define a function

f(x,y=5,z) := {
return x*y*z;



will return the product 1*2*3=6. If you give f only two values as input,


then these values will be given to the parameters which don’t have default values; in this case, y will get its default value 5 while 3 and 4 will be assigned to x and z, respectively. The result will be x*y*z=3*5*4=60.

Previous Up Next