contents   index   previous   next

Function return statement


The return statement passes a value back to the function that called it. Any code in a function following the execution of a return statement is not executed.


function DoubleAndDivideBy5(a)


   return (a*2)/5  



Here is an example of a script using the above function.


function main()


   var a = DoubleAndDivideBy5(10);

   var b = DoubleAndDivideBy5(20);

   Screen.write(a + b);



This script displays12.


Passing information to functions