My mistake. I had not realized the select/switch mistake. Thanks!

David Logan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED]
Sent: Saturday, June 17, 2000 12:43 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] return doesn't work as documented Re:



Hi David,

return works but switch does not, the throw attribute is missing. This
is a correct version of switch from REBOL/View:

switch: func [
    "Selects a choice and evaluates what follows it." [throw]
    value "Value to search for."
    cases [block!] "Block of cases to search."
    /default case "Default case if no others are found."
][
    either value: select cases value [do value] [
        either default [do case] [none]]
]

--
Michal Kracik

[EMAIL PROTECTED] wrote:
>
> The Rebol/Core Dictionary states that return "Returns a value from a
> function."  But the following example shows this is not true:
>
> >> z: func [][switch "i" ["z" [print "Z"] "i" [print "Here" return
"Hello"]]
> return "Goodbye"]
> >> z
> Here
> == "Goodbye"
>
> It appears as though return returns from a block scope, not a function
> scope. Examination of the Users guide did not provide any additional
clues,
> nor did the online FAQ (except the fact that all of the examples in the
> Users guide had a return at the function scope.)
>
> Any ideas?
> David Logan

Reply via email to