Error in my program

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.

1 Like

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.

1 Like

bump

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.

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.

1 Like

Remove this whole block:

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.

1 Like

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.

1 Like

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

1 Like

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