For each item fails to work


ProbList = 8,4,7,5,7,6,5,2,1,3,6,8,4,9,4,6,9,8,6,4
Length = 20
When I use “count” I get all the list items listed correctly from 8, 4, … 6, 4
I remove the “count” and replace it with a “for” and that lists haphazardly like 2, 5, 7, 5, 6 , 7, 4, 8 …

What a I missing. Please advice

when you use for the variable j already contains the item in the array - you are trying to use j as an index to the array!
here’s what you get for the first iterations of for and , based on your usage, the corresponding item in the same array!
iter1 , j=8, 8th parameter of Problist → 2
iter2 , j=4, 4th parameter of Problist → 5
iter3 , j=7, 7 th parameter of Problist → 7
iter4 , j=4, 4 th parameter of Problist → 5
etc.
that;s why your output is 2,5,7,5,…

just change your set statement to use j directly
set "Error txt"s text to “j”

1 Like

Sorry sorry so silly of me. You are right, thank you very much. The documentation is also right. I wish Thunkable would give bit more detailed information with a working simple example. Thanks again

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