# Working with Lists Errors

**URL:** <https://community.thunkable.com/t/working-with-lists-errors/744305>\
**Category:** Questions about Thunkable X\
**Tags:** lists, loops\
**Created:** [August 15, 2020, 4:15pm UTC](https://community.thunkable.com/t/working-with-lists-errors/744305 "2020-08-15T16:15:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![liberteacher](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@liberteacher](https://community.thunkable.com/u/liberteacher)\
**Post date:** [August 15, 2020, 4:15pm UTC](https://community.thunkable.com/t/working-with-lists-errors/744305/1 "2020-08-15T16:15:49Z")

</div>

I’m building a game with a high scores list, and I can’t seem to get the the high score inputed into the right part of the list.

Here’s the problem replicated in a new app.  
In this app, just make sure you click on the label to add the items to the list.

Then try adding in numbers, and you’ll soon realize the numbers are not being added in the correct spot. I’m wondering if the first occurrence of item block is the problem.

[https://x.thunkable.com/copy/c32f48ce11f5d5465040965c07dd4d72](https://x.thunkable.com/copy/c32f48ce11f5d5465040965c07dd4d72)

 ![Screen Shot 2020-08-15 at 9.15.21 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/c/9cc9aac624a05aca253331173fa37a6bfb698d06.png)  
 ![Screen Shot 2020-08-15 at 9.18.21 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/f/2f068d96396784ee602ce39fb853343d1afef038.png)

I’ve also tried without using first occurrence block and get the same error:

 ![Screen Shot 2020-08-15 at 9.23.01 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/6/a688c9a0d1af44e7347982eecee15eb5259cd02a.png) ![Screen Shot 2020-08-15 at 9.18.21 AM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/f/2f068d96396784ee602ce39fb853343d1afef038.png)

I’m not sure if on the backend it is looking at these numbers as a string instead of integers. Because of that it is thinking that the first number in a 2 digit number is the one that it compares…

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [September 1, 2020, 10:17pm UTC](https://community.thunkable.com/t/working-with-lists-errors/744305/2 "2020-09-01T22:17:13Z")

</div>

Hey @liberteacher,

Any chance you have the points and name variables the wrong way around here?

---

<div class="post-metadata">

**Author:** ![liberteacher](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@liberteacher](https://community.thunkable.com/u/liberteacher)\
**Post date:** [September 1, 2020, 10:36pm UTC](https://community.thunkable.com/t/working-with-lists-errors/744305/3 "2020-09-01T22:36:28Z")

</div>

Just checked again and no luck and I made sure.  
Here’s the same project with the variable renamed as list.  
[https://x.thunkable.com/copy/60a525ccd4c8ffd69544a4fdb861a6f5](https://x.thunkable.com/copy/60a525ccd4c8ffd69544a4fdb861a6f5)

I think it has something to do with getting the number from the list.

Thanks for looking in to this!

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [September 1, 2020, 10:52pm UTC](https://community.thunkable.com/t/working-with-lists-errors/744305/5 "2020-09-01T22:52:25Z")

</div>

Are you sure you want to use the `TextInput changes` block here? This means that if you enter a two digit number the `cloud points` variable will change twice…three times for 3-digit numbers, and so on.

> [@liberteacher](#):
>
> I can’t seem to get the the high score inputed into the right part of the list.

Can you clarify this part please. i.e:

“When the game ends I want the score to be added to the end of the list”

or

“When the game ends, the score should be inserted in numerical order into the list”

etc.

Thanks! 👍

---

<div class="post-metadata">

**Author:** ![liberteacher](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@liberteacher](https://community.thunkable.com/u/liberteacher)\
**Post date:** [September 1, 2020, 11:11pm UTC](https://community.thunkable.com/t/working-with-lists-errors/744305/6 "2020-09-01T23:11:49Z")

</div>

> [@domhnallohanlon](#):
>
> i

Hi,  
The “When text input changes” is just used for testing purposes. In the game it it triggers when the lives = 0.  
To clarify, I’d like the number to be added to the list in order from greatest to least.  
Thank you!

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [September 2, 2020, 10:49am UTC](https://community.thunkable.com/t/working-with-lists-errors/744305/7 "2020-09-02T10:49:37Z")

</div>

Thanks for clarifying. Ok, so for this:

> [@liberteacher](#):
>
> I’d like the number to be added to the list in order from greatest to least.

You’d need to break it down into two steps.

1. Add the score to the list
2. Sort the scores in descending order.

One more question - will you need to get player names to go with the scores too? (this will complicate things slightly!)

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:24pm UTC](https://community.thunkable.com/t/working-with-lists-errors/744305/8 "2024-11-08T12:24:17Z")

</div>


