> 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
>

Hi,

the problem (already solved in Rebol/View) is, that  Switch is a
function, which executes the Return in question. You can see its
source code by executing:

source switch

If you would do the same code in Rebol/View, you would experience
one attribute in Switch definition - [throw], which is essentially
an instruction for Switch to tell the calling function Return has
been evaluated.

    Ladislav

Reply via email to