Static Variable?! 
Author Message
 Static Variable?!

Hi Guys,

Is there anyway to declare and use a static variable in scripting???

Thanks,

Samer



Mon, 09 Jun 2003 23:33:59 GMT  
 Static Variable?!
hi Samer,

the usual way implement a "static" variable, is to include it in the
prologue of Dim statements (before any script code).

If it makes you feel better, you could declare it as "Public", but that
doesn't buy you anything more than just dim...

cheers, jw


Quote:
> Hi Guys,

> Is there anyway to declare and use a static variable in scripting???

> Thanks,

> Samer



Tue, 10 Jun 2003 04:31:31 GMT  
 Static Variable?!

No, VBScript does not support static procedure level variables (assuming
that's what you meant).

---Variables Dim'd within a procedure have only local scope and do not
persist across procedure calls.
---Variables Dim'd outside any procedure have global (page/script) scope and
accessible within all procedure calls.

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--


Quote:
> Hi Guys,

> Is there anyway to declare and use a static variable in scripting???

> Thanks,

> Samer



Tue, 10 Jun 2003 10:34:02 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Static variable not static enough ???

2. Static variables are not supported...

3. Static Variable (VB)

4. Static variables...when to use?

5. Too many local, non-static variables

6. "Permanently" static variables

7. static variables

8. Would like to get value from local static variable

9. Newbie: static variable initialization

10. Static variables/scope - "Accumulate"?

11. Static variables - simpler question

 

 
Powered by phpBB® Forum Software