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