Can you attach the initialize variable block to your code?

I need to initialize a variable in the code. I need to attach it to a if loop. This if loop is to happen as many times as the user wants it to. And everytime the user logs in, the if loop is performed. The values that the user enters has to be shown later. If I store those “infinite” no. of values in one variable, i dont think it would work. Please help.

1 Like

Can you use the Set variable block instead of the initialize block within your loop?

No. I need to CREATE a new variable and this CREATING things will happen multiple times…

It sounds like you need to use a database instead of individual variables. You should use a data structure (such as AirTable or Google Sheets) that allows you to add and remove rows whenever you need to.

how do i do this


As @tatiang indicates you will probably need to use a database later on. But for now…

What you are describing is a list (aka Array). Thunkable variables have 4 different “scopes”

  1. Cloud: shared by all users of your app
  2. Stored: Saved on device until the app is uninstalled or the app Cached data is cleared
  3. App: Only lasts until the app is closed
  4. Screen: Only existing on a particular screen

From your description, it sounds like you want a Stored variable. Here is an example of how to initilize a Stored variable, then add a new entry each time the user opens the app.

Happy Thunking!

1 Like

I have not seen this variable. I’ve only known of cloud, stored, and app variables but never encountered screen variables. How do I initialize one?


These are created when you add a loop block.

Oh, like j and i

Yes, but you can rename them to useful variables.

Function parameters also are screen level variables

OK, thanks very much!