Need Help! While loop not functioning as intended

I don't understand why this isn't working. The code intended needs to print all four items in a list, and is supposed to stop at 4, because that's the length of the second list. However, the error message says that there's nothing at index 5?

You are incrementing listCheck by one at the start, rather than the end. Move those blocks to the bottom of the while loop (whilst still remaining inside the loop) and it should be fine.


Are you running a similar while loop elsewhere in the app? Perhaps that might be causing it.

I'm not, this is the only loop I'm using.

A small favor: could you please upload the .aia file of your project here?

@NishyanthKumar any ideas?

I am genuinely confused. My logic should be soundproof. When I re-arranged a few things, the app just started crashing. Perhaps something is wrong with your .aia file itself.
My app was crashing because my phone was on 2% :sweat_smile:

1 Like


Eliminate the space in Computer Scientist to something like Computer_Scientist and your app will work. :astonished: Your app thinks there are 5 items in your list while there really are only 4.

1 Like

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