Getting an error : Attempt to get item number 4 of a list of length 3

I’m trying to make a simple button to iterate a list of items, I don’t understand why the blocks give me an error even though I think I handled the 2 possibilites (> list count and < list count)
Can someone help plz, what I’m doing wrong?



I

Hi @Houssam_Zakaria,

I think just make (Speak) block before (index = index + 1) block

3 Likes

@Moayad_Zaidan is correct.

If ‘index’ is 3, then it respect your “if” condition; but the first thing you do then is increment it, so now it is 4, and is out of range.

2 Likes