Select list item: Attempt to get list item 6 of a list of length 5

Hello, when I test my app with MIT ai2 Companion I have a runtime error and I don't know where the error come from.
So, is there a way to have a marker on a block when a runtime error appear, to know where is the error?

Please screenshot your runtime error

1 Like

I think I get what is the problem, is that possible to stop a For loop like that?
blocks (1)

Do it this way(not tested but should work) -

I change it by using a while but thank you I will know it for future blocks :slight_smile:

1 Like

If you try to get an element from the list, it is always a good idea to check whether the index is larger that the length of the list. I cannot see from your blocks where that should be done. Also consider using controls_forEach
in your blocks, orblocks (54)
because this will allow you to handle lists with another length, that you may not know in advance.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.