[Solved] My stored variable keeps showing NaN

Hi i need to use thunkable for a school project, only problem is my teachers dont know a thing about thunkable so i’m turning to this forum. i have my code in the image and i need the app cost to show up on the order total label

, however it shows NaN instead, how do i fix this, thanks!

Why are you using stored variables?

The code looks good. I’m not sure why you’re getting NaN for your total. If you want to share the link to your project, I can take a look and see if there’s some other reason it’s not working right.

If you stick with Thunkable, you may want to look into local databases and tables/spreadsheets. It can make your coding much more efficient.

1 Like

Hey @adiyy.khanic22, try changing app var to stored var that sorted me out when I had those issues.

1 Like

Hi @adiyy.khanic22,

when you use a “stored” variable it is “undefined” at the beginning. And when you add a value to it, it keeps being undefined. So just enter a block to set it to a starting value like this:

grafik

  • Be shure to use the Block “Screen1.Starts”, and not “Screen1.Opens”
  • if you change the type of score from “stored” to “app” then things are easier, but the value will get lost after closing the app. A “stored” variable will be present the next time you start the app.
4 Likes