# rtn

Definition: | include xpGUI.e rtn identifier [but more often just specified inline]
Description: | Type. Technically an integer index into the symbol table, or NULL, but usually specified as the plain identifier of a function or procedure, without a trailing '(', since that would of course make it an invocation of that code.
pwa/p2js: | Supported, or at least understood by pwa/p2js and mapped to "let /*rtn*/" aka (almost) completely ignored, since JavaScript is a typeless language. As per unwise, xpGUI.js does not even have a fake version, which you should not ever want anyway. Note that on desktop/Phix a rtn is an integer (index to the symbol table) whereas in JavaScript it is the actual (raw) function [pointer]. Hence like gdx, an application should refrain from printing, comparing (etc) rtn variables, except perhaps during initial debugging.
Example: |
    include xpGUI.e

    function quit(gdx h)
        return XPG_CLOSE
    end function

    gdx quit_btn = gButton("Quit",quit) -- << last param here
Note that gQuit is functionally identical to and can be used in place of the quit function above.
See Also: | gButton, get_routine_info
Technicalia | You can theoretically (and xpGUI.e does) use get_routine_info() to get further details, and as ever should bear in mind the standard unwise nature of using this type to definitively determine whether an object is in fact such, as many things which are clearly not (eg 145, '7') may well pass, aka the rtn type is not "properly tagged". It does however check that a non-null value is numerically greater than the last routine of xpGUI.e, ie it is a routine which has been declared somewhere after the "include xpGUI.e" statement, as it would need to be if, say, using the gdx type or returning XPG_CLOSE, most notably excluding all builtins. It also explicitly permits a small handful of internal/private/default handlers.