Need an example of how to use "try" and "catch"

Pete pete at mollysrevenge.com
Thu Mar 22 12:55:20 EDT 2012


You're getting an error because the catch part of try takes only 1
parameter - the variable that holds the error - not two as in the script.

Also, as noted by Peter, the try statement doesn't help you with the
specific example you used since getting a non-existant custom property
doesn't cause an error.  I've sometimes wished there was a preference
similar to the "Strict Compilation Mode" to deal with that.

Pete

On Thu, Mar 22, 2012 at 9:22 AM, Jim Hurley <jhurley0305 at sbcglobal.net>wrote:

> Bob,
>
> Yes that would be fine, except that I get a compilation error at the line:
>
>  catch theError, theNum
>
> RR says:  (try: not a command), char 7
>
> Jim
>
>
> > Bob Sneidar wrote:
>
> > try
> >   put "foo" into myVar
> >   put the value of myVarr
> > catch theError, theNum
> >   -- breakpoint
> >   answer theNum & cr & line1 of theError as sheet
> >   exit to top
> > end try
> >
> > Is that what you mean?
> >
> > Bob
> >
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>


-- 
Pete
Molly's Revenge <http://www.mollysrevenge.com>



More information about the use-livecode mailing list