Thanks a lot, Sunanda. I never saw this rebol' particularity before.

Phil
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 19, 2002 12:09 PM
Subject: [REBOL] Re: Return of a function


> Philippe:
> > Why hm is local to function ? There's no /local refinement + The hm is
> >  called outside. So in my understanding, hm shouldn't be local..
> >  So what I have to do  to have a global variable ??
>
> Hm is the _local _name for the _value_ (not, in this case, variable)
passed
> in.
>
> What is returned is a _value_ not a variable.  Try this:
>
>  test-func: func [value] [
>       value: value + 200
>       return value
>       ]
>
> print test-func 100
> print value
>
> the first 'print correctly prints 300. The second fails as the word 'value
> only has a meaning within the function. If you want a global variable
'value
> too, then:
>
> value: test-func 100
> print value         ;; prints the global 'value, ie 300
>
> another-value: test-func 500
> print another-value   ;; prints 700
> print value     ;; prints 300. Changing 'value in the func doesn't affect
the
> global variable
>
>
>
> Sunanda.
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to