[30 Jan 2010] function return value

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
User avatar
lazi
Posts: 552
Joined: Thu Feb 24, 2011 11:08 pm

[30 Jan 2010] function return value

Post 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()) 
/***************************/

User avatar
airsoftsoftwair
Posts: 4320
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[31 Jan 2010] Re: function return value

Post 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 :)

Locked