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

Peter M. Brigham, MD pmbrig at gmail.com
Thu Mar 22 11:40:58 CDT 2012


On Mar 22, 2012, at 12:22 PM, Jim Hurley 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

The syntax for the try construction is

try
   <command here>
catch tError
   <other commands here>
end try

and the error number is put into the variable tError. So the <other commands> could be, eg,

   if tError = 314 then
      answer "range error in loading array"
   else if ...
      etc.
   end if

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig




More information about the use-livecode mailing list