# Error in my program

**URL:** <https://community.thunkable.com/t/error-in-my-program/1653955>\
**Category:** Questions about Thunkable X\
**Tags:** design, beginner\
**Created:** [December 14, 2021, 5:33am UTC](https://community.thunkable.com/t/error-in-my-program/1653955 "2021-12-14T05:33:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![24leesebastia602](https://avatars.discourse-cdn.com/v4/letter/2/8e8cbc/32.png) [@24leesebastia602](https://community.thunkable.com/u/24leesebastia602)\
**Post date:** [December 14, 2021, 5:33am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/1 "2021-12-14T05:33:43Z")

</div>

My code is not working, I’m pretty new at Thunkable, it is suppose to return the answer but it returns as NaN. It has something to do with the item block(for item(item) in list) because everytime I insert the item variable, it reports NaN. What is wrong with me code? Thanks in advance.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/b/db16229d8bdd25f5f20c74c2365ceffad16b091d.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/9/a98ae2746f331e9bc10e947dae5b427e33add603.png)

---

<div class="post-metadata">

**Author:** ![24leesebastia602](https://avatars.discourse-cdn.com/v4/letter/2/8e8cbc/32.png) [@24leesebastia602](https://community.thunkable.com/u/24leesebastia602)\
**Post date:** [December 14, 2021, 5:39am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/2 "2021-12-14T05:39:56Z")

</div>

I have a list of costs in the list variable total cost and im trying to get each value of the list with for each item item in list, but item doesn’t work.

---

<div class="post-metadata">

**Author:** ![24leesebastia602](https://avatars.discourse-cdn.com/v4/letter/2/8e8cbc/32.png) [@24leesebastia602](https://community.thunkable.com/u/24leesebastia602)\
**Post date:** [December 14, 2021, 6:08am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/3 "2021-12-14T06:08:48Z")

</div>

bump

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 14, 2021, 6:12am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/4 "2021-12-14T06:12:35Z")

</div>

When you use a `for each item in list` block, it returns a list item, not an integer. You’re then trying to use the `item` value as a list item #. That won’t work. Instead, replace the `in list [] get #` block with the `item` block.

---

<div class="post-metadata">

**Author:** ![24leesebastia602](https://avatars.discourse-cdn.com/v4/letter/2/8e8cbc/32.png) [@24leesebastia602](https://community.thunkable.com/u/24leesebastia602)\
**Post date:** [December 14, 2021, 6:15am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/5 "2021-12-14T06:15:46Z")

</div>

Hello Tatiang,

I don’t think I understand what you mean. Could you show me through a picture somehow? I am a visual learner and relatively new to thunkable. Sorry for the inconvenience. But thanks for your help.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 14, 2021, 6:18am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/6 "2021-12-14T06:18:56Z")

</div>

Remove this whole block:

 ![Screen Shot 2021-12-13 at 10.16.29 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/a/ca63e035523286b15fe5c4b8ebbb0d86e0d5a8e3.jpeg)

And in its place, put the orange `item` block.

So that line of code/blocks should read: `set app variable Subtotal to app variable Subtotal + item`

If that doesn’t help, let me know and I can make a quick mock up or video.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 14, 2021, 6:21am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/7 "2021-12-14T06:21:36Z")

</div>

It just takes a little while for me to make all of those variables and blocks in a new project… if you want to share your project link with me, I can make a video of what I mentioned.

---

<div class="post-metadata">

**Author:** ![24leesebastia602](https://avatars.discourse-cdn.com/v4/letter/2/8e8cbc/32.png) [@24leesebastia602](https://community.thunkable.com/u/24leesebastia602)\
**Post date:** [December 14, 2021, 6:22am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/8 "2021-12-14T06:22:08Z")

</div>

It works! Thank you so much! I was stuck on this for hours until I found this forum.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [March 14, 2022, 6:22am UTC](https://community.thunkable.com/t/error-in-my-program/1653955/9 "2022-03-14T06:22:50Z")

</div>

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