Example of Functions which return values:
Calling this function prints the circumference, since there is no way to store the value, hence, it can be used in following computations:
As no value is returned by the function, it would be an error to attempt to store the value in a variable:
>> c = calccircum1(3.3)
??? Error using ==> calccircum1
Too many output arguments.
By dissimilarity, the function below computes and returns the circumference, and hence, it can stored and used in other computations. For illustration, if the circle is the base of a cylinder, and we wish to compute the surface area of the cylinder, we would require to multiply the result from the calccircum2 function by the height of the cylinder.
>> circumference = calccircum2(3.3)
>> height = 4;
>> surf_area = circumference * height