Page 1 of 1

[30 Jan 2010] function return value

Posted: Sat Jun 13, 2020 5:32 pm
by lazi
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sat, 30 Jan 2010 14:41:39 +0100

Hi!

Just a simple question:

Why not works equally these to scripts?

Code: Select all

/************************/
DebugPrint (
Function()
    Return (1,2,3)
EndFunction
)       
/*************************/

/*************************/
Function p_threevals()
    Return (1,2,3)
EndFunction

DebugPrint(p_threevals()) 
/***************************/

[31 Jan 2010] Re: function return value

Posted: Sat Jun 13, 2020 5:32 pm
by airsoftsoftwair
Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 31 Jan 2010 22:06:57 +0100
Hi!

Just a simple question:

Why not works equally these to scripts?
Well, in the first call you're actually declaring a function. You're not calling it. You need to do it the following way:

Code: Select all

DebugPrint((Function() Return(1, 2, 3) EndFunction)())
But this is not good coding style :)