[REBOL] Re: For loop and dynamic variable
From: greggirwin:mindspring at: 18-Apr-2002 10:25
Hi Richard,
How about:
outputs: [%output1.tmp %output3.tmp %output3.tmp]
foreach file outputs [
if exists? file [
delete file
]
]
Then you can also access them as outputs/1, etc. if you want.
--Gregg
I have the following code :
output1: %output1.tmp
output2: %output2.tmp
output3: %output3.tmp
if exists? output1 [ delete output1 ]
if exists? output2 [ delete output2 ]
if exists? output3 [ delete output3 ]
I want to simplify it like this :
for i 1 3 1 [
output(i): %output(i).tmp
if exists? output(i) [ delete output(i) ]
]
Any ideas ?
TIA
Richard Coffre
France Telecom Orbiscom
Tél. : 01 47 61 46 28
Share what you know, learn what you don't