strange error in a repeat loop

Andre.Bisseret Andre.Bisseret at inria.fr
Tue Feb 24 02:47:04 EST 2009


Bonjour, Bob and Robert (and all),

Le 23 févr. 09 à 18:40, Robert Brenstein a écrit :

> 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
------------
Robert, I adopted all your suggestions and now, all is running like a  
charm. (It is the first time I use an array ;-))
------------------------------------------------------------------------------------

Le 23 févr. 09 à 17:59, Bob Sneidar a écrit :

> Obviously the value here is not empty and is not a number.
>
> Did you try stepping through the code and seeing what the value is  
> at the time you get the error?


Thank you Bob ; right, some spaces were staying there in one item !!
>




More information about the use-livecode mailing list