I use a global variable oject near the top of all my scripts.

something like this:

gv: make object! [
    this: 1
    that: 2
    thing: 3
]

Then I call the global vars any time I want from any where in a script...
  gv/this 
  gv/that 
  gv/thing


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 09, 2000 3:45 PM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] "static" variable Re:
> 
> 
> You can do this with a global variable, but I too would be 
> interested in
> knowing if Rebol has directly implemented this for variables 
> local to a
> function, but I think I've figured out the answer (or at least a
> work-around). Declaring a local variable to a block (without 
> using make
> block!) will retain the value to that block. So, you can keep 
> all of your
> static data within that block.
> 
> f: func [][
>       static: [0]
>       either zero? static/1 [
>               change at static 1 1
>               print "Function called first time"
>       ][
>               print "Function called the next time"
>       ]
> ]
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 09, 2000 11:44 AM
> To: [EMAIL PROTECTED]
> Subject: [REBOL] "static" variable
> 
> 
> Hi, 
> 
> Does anyone know whether Rebol has such a kind of variable: 
> you initialize
> this
> variable at the first time you run the script. In this 
> script, the variable
> will
> be modified to some value. If you run this script again, this 
> variable will
> preserve the value it has in last run.
> 
> Thanks in advance.
> 
> Tiana
> 

Reply via email to