This creates a method that is, in effect, a UDF and returns a value. The return value is passed back with the familiar RETURN command. Note that although there is a RETURN command, an ENDFUNC is still added to close the function.
The notes regarding procedure methods are applicable for function methods as well.