function Statement

Top  Previous  Next

Declares the name, arguments and statements of a function procedure.


Function name [(variable1), (variable2), (variable3)]


   [expression statements]

End Function


When function name is called, the list of variables (variable1, variable2, variable3) is passed to the function procedure, statements are executed and expression statements return the value of the function.


To return a value from a function, assign the function name to a variable. You can also return a function value without storing it, using the Net.write(function name) command.


function f(a,b)


return a*b;


Net.write(f(4,3));// Returns 12