Hi all,

A na�ve question : how do you define a local variable in a function and
then return it:

Instead of this :

dirtree: make block! 100
list-dirs: func [
        "returns dir tree as block"
        dir [file!] "root dir" 
        ] 
        [
        foreach name read dir [
                if dir? dir/:name [
                   append dirtree dir/:name
                   list-dirs dir/:name
                ]
        ]
        dirtree
]
  
Something like this :

list-dirs: func [
        "returns dir tree as block"
        dir [file!] "root dir" 
        ] 
        [
        dirtree: make block! 100
        foreach name read dir [
                if dir? dir/:name [
                   append dirtree dir/:name
                   list-dirs dir/:name
                ]
        ]
        dirtree
]

Problem is that " print list-dirs %/root " only works with the first block of code, not
the second.

What do I get wrong ?
--
[EMAIL PROTECTED]
http://perso.worldonline.fr/mutant



Reply via email to