[REBOL] Re: For loop and dynamic variable
From: sunandadh:aol at: 18-Apr-2002 6:21
Richard:
> for i 1 3 1 [
> output(i): %output(i).tmp
> if exists? output(i) [ delete output(i) ]
> ]
>
> Any ideas
I'd write:
for i 1 3 1 [
file-name: to-file join "output" [i ".tmp"]
if all [exists? file-name
not dir? file-name ][
delete file-name
] ;; if
] ;; for
(I've added a check that the resultant name isn't a directory (folder) just
because I'd do that in my own code. May be you don't need it in your
application).
Sunanda.