strange error in a repeat loop

Robert Brenstein rjb at robelko.com
Mon Feb 23 12:40:55 EST 2009


On 23.02.09 at 16:33 +0100 Andre.Bisseret apparently wrote:
>YEsss !
>Thanks a lot Thierry and Robert ; both of you where right : I had a 
>couple of spaces in item 9 of line 1 of my field !!
>Kind of things I should have suspected ; but I was really "brain 
>stuck" (not sure this is a good expression ;-)))
>Now, my handler is working nicely

You can easily add a pre-check to avoid runtime errors:

   repeat with i=5 to 12
      get item i of enil
      if it is not a number then -- 'not an integer' if more appropriate
         answer error "Not a number:" && it
      else
        add it to tLesVars["total"&i]
      end if
   end repeat

The error msg may include the problem line number and item number, of course.

Robert



More information about the use-livecode mailing list