get return value from .gsf function

Pablo Romero romero619 at HOTMAIL.COM
Mon Mar 9 00:47:16 EDT 2009


I've never been able to get the following to work: use the 'return(varname)' statement within a .gsf function to return a value.

I've only been able to accomplish the passing of variables around between scripts by using '_varname' global variables. This defeats the whole purpose of creating a script function.

I want to create a .gsf function that can actually return a value that can be directly assigned to a variable in a .gs file. example:

*gsf file, addit.gsf
function addit(var1,var2)
sum=var1+var2
return (sum)

*test gs file, tst.gs
rc = gsfallow("on")
tx=addit(2,3)
say '2+3 is 'tx


this doesnt work...it simply prints '2+3 is ', so the gsf function is NOT returning the value of the 'sum' variable...

Is this by design or am I doing something incorrectly?
are global variables the ONLY way to pass variables between script/script function files?

P.Romero
_________________________________________________________________
Express your personality in color! Preview and select themes for Hotmail®.
http://www.windowslive-hotmail.com/LearnMore/personalize.aspx?ocid=TXT_MSGTX_WL_HM_express_032009#colortheme



More information about the gradsusr mailing list