Often you want a function to return a value, either a result from a calculation that has been done in the function, or just a Boolean to indicate whether the function did what it was supposed to. To return a value to the statement that invoked the function, use the return statement:
return expression
The return statement will terminate a possible loop and send the value to the statement that invoked the function.
Returning a Calculated Value from a Function
The following function will return what percentage the number n is out of the base b:
function Percentage(n : int,b : int) : float
{
return (n/b)*100;
}