> I'm having trouble getting my mind around how to do something in Gambas, > and I'm hoping that someone can explain (or even better, show) how to do > it. > > As part of an application I'm trying to write, I need to be able to > change a variable in a subroutine and still have the value available the > next time the subroutine is called. I _used_ to think that this was > called a "static" variable, but now I'm not so sure any more :-) > > How can I keep the value of a variable intact between calls to the same > subroutine? > > sub Routine() > V as integer > > select case V > case 0 > V = 3 > case 1 > V = 2 > case 2 > V = 0 > case 3 > V = 1 > case else > V = 0 > end select > > end > > Each time I call the subroutine, I want it to "remember" what "V" was. > How? > > DMerriman
You must declare your static variable globally, as you cannot do that locally in Gambas. Regards, -- Benoît ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user