[REBOL] Re: For loop and dynamic variable
From: ronald:free at: 18-Apr-2002 14:02
Bonjour COFFRE,
Thursday, April 18, 2002, 12:01:12 PM, vous avez écrit:
CRF> Hi
CRF> I have the following code :
CRF> output1: %output1.tmp
CRF> output2: %output2.tmp
CRF> output3: %output3.tmp
CRF> if exists? output1 [ delete output1 ]
CRF> if exists? output2 [ delete output2 ]
CRF> if exists? output3 [ delete output3 ]
CRF> I want to simplify it like this :
CRF> for i 1 3 1 [
CRF> output(i): %output(i).tmp
CRF> if exists? output(i) [ delete output(i) ]
CRF> ]
CRF> Any ideas ?
CRF> TIA
CRF> Richard Coffre
CRF> France Telecom Orbiscom
CRF> Tél. : 01 47 61 46 28
CRF> "Share what you know, learn what you don't"
CRF> --
CRF> To unsubscribe from this list, please send an email to
CRF> [rebol-request--rebol--com] with "unsubscribe" in the
CRF> subject, without the quotes.
This should make the job :
num: [1 2 3]
foreach ind num [if exists? todelete: to-file rejoin ["output" ind ".tmp"][delete todelete]]
--
Best Regards,
Ronald