Hi Pat,

>What is the meaning of thro?
>I have seen it here and there but never quite understood its purpose.
>
>Regards
>Patrick
>
>
>----- Original Message ----- 
>From: "Ladislav Mecir"
>
>  
>
>>yes, it is useful. The following improvement uses the [throw] attribute
>>to make the behaviour of the function more standard with respect to
>>    
>>
>Return:
>  
>
>>trif: func [
>>    {Three case if}
>>    [throw]
>>    condition
>>    iftrue [block!]
>>    iffalse [block!]
>>    ifnone [block!]
>>] [
>>    do either condition [
>>        iftrue
>>    ] [
>>        either none? condition [
>>            ifnone
>>        ] [
>>            iffalse
>>        ]
>>    ]
>>]
>>
>>; example:
>>
>>f: does [trif request "give an answer" [return "yes"] [return "no"]
>>    
>>
>[return "cancel"] "Shoudn't get here"]
>  
>
Try to use the version of the above function without the [throw] 
attribute and you will find out, that the result of F will be:

== "Shoudn't get here"

, which indicates, that the Return got "consumed" by Trif , while what 
we intended was to "throw" Return to F. The "throw" attribute does 
exactly that - throws Return to caller functions.

Merry Christmas

-Ladislav

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.

Reply via email to