General Function Form
in general, the form of a user-defined function is as follows:
n
n
n
n
n
n
n
n
nfunction names follow the same rules as variables: consist of letters, digits, and underscores and must start with a letter
nnote that there may be:
pmore than one parameter, separated by commas
pno parameters at all, in which case the function name is followed by ()
pmore than one statement inside the curly braces ,separated by semicolons
function FUNCTION_NAME(PARAMETER_1, PARAMETER_2,..., PARAMETER_n)
// Assumes: DESCRIPTION OF ASSUMPTIONS MADE ABOUT PARAMETERS
// Returns: DESCRIPTION OF VALUE RETURNED BY FUNCTION
{
    STATEMENTS_TO_PERFORM_(AND_RETURN)_THE DESIRED_COMPUTATION;
}
function difference(num1, num2)
// Assumes: num1 and num2 are numbers
// Returns: the difference between num1 and num2
{
    return (num1 – num2);
}