View Full Version : Global Proc - beginner question

11 November 2011, 03:12 PM
It seems like I haven't left this forum in a week, but I'm having fun here. I'm going to say in advance that this is a n00b question. There are several "explanations" out there, I'm trying to understand but they all confuse me.

Could some one explain this to me in the simplest terms possible?

global proc string Hello(int $something, string $somethingElse)

I don't understand the need for the things within the parenthesis. What do they do? Do you HAVE to put them there?


11 November 2011, 05:10 PM
I believe those are called arguments and that they're used to pass information from one procedure to the next.

11 November 2011, 06:51 PM
Think of a procedure as a factory that does work. Like 13xbmspec said, arguments are inputs...ingredients that a factory needs to do its work. So for example:

global proc string Hello(string $firstName, string $lastName) {

string $result = $firstName + " " + $lastName;

return $result;


My inputs are $firstName and $lastName. And in this case, $result is my output. So to use this in a script, I'd say:

string $fullName = Hello("Mickey", "Mouse");
and "Mickey Mouse" would be placed into $fullName.

You use procedures to encapsulate tasks associated with a particular action. Hope that helps:)

11 November 2011, 11:45 AM
as for the 'global' and variable scope;

CGTalk Moderation
11 November 2011, 11:45 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.