Page 1 of 1

Subpograms

Posted: Thu Nov 04, 2010 6:47 pm
by ilbarbax
Hi,

May be already exists and I'm putting a silly question....

I faced some problems in handling indipendent portions of program by taking care to the variables used, cleaning memory delete brushes, sprites etc.

I think could be very usefull to have statement like Function, but with the big difference that when exing from it all variables, graphics elemets etc used by this function are automatically deleted.

Sandro

Re: Subpograms

Posted: Thu Nov 04, 2010 6:56 pm
by jalih
ilbarbax wrote:I think could be very usefull to have statement like Function, but with the big difference that when exing from it all variables, graphics elemets etc used by this function are automatically deleted.
Hello Sandro,

Just declare your variables as Local inside the Function, otherwise Hollywood defaults to Global variables.

Local variable:

Code: Select all

Local x = 0
Global variable:

Code: Select all

x = 0