How to? user function

Hello -- are user function just 1 line? can they have logic in then and return a string? Thanks
Yes, they are one-liners.
Their purpose is to return a string. @IF[] can be useful in a user-defined function. There are tricks which may/may not work to your satisfaction. @EXECSTR[] will grab one line of output from an EXE or a BTM. For example:
v:\> function factors `%@execstr[v:\factor.btm %1]`
v:\> echo %@factors[40]
v:\> echo %@factors[99]