Using 'try'

Graham Samuel livfoss at mac.com
Thu Apr 13 03:28:52 EDT 2006


In the very interesting discussion on Custom Properties, Mark Wieder  
introduced this example

> setProp NewValue pValue
>   try
>     if pValue < 0 then
>       set the foreColor of me to "red"
>     else
>       set the foreColor of me to empty
>     end if
>   end try
>   put pValue into me
> end NewValue

I think I get the idea, but Mark, why did you use 'try'? It would not  
occur to me to do this - indeed I don't think I've ever used 'try',  
which if I understand correctly, allows the script to capture an  
error rather than handing it to the RR engine: but that involves  
'catch' doesn't it? Is there any advantage to using 'try' the way you  
did?

Just curious - there's so much I don't know!

Graham


------------------------------------------------------------------------ 
---
Graham Samuel / The Living Fossil Co. / UK and France




More information about the use-livecode mailing list