"Looping" a loop

Hello. I need an aproach strategy in thunkable to solve this kind of action:
01
The closest block i found in Thunkable for that is “count with i from x to y” so:


My problem is that on my secont count inside the first, i cannot change variable “i”… Renaming will change first too…
Maybe count is not intended to solve this, and you will point me to other block :slight_smile: Thank you.

Just create a new variabele and Use that one.
The i in the loop is the same as the first.
So it renames automaticly both.

1 Like

im so dumb… and i was trying to make this selecting only from implicit list :blush:


thank you

2 Likes

You’re welcome.

… but now i have another issue …
lets say that i=2; j=3 … i have 6 items in generated list, but, in my example, list looks like:
sector_0_stand_0
sector_0_stand_0
sector_0_stand_0
sector_0_stand_0
sector_0_stand_0
sector_0_stand_0

instead of
sector_1_stand_1
sector_1_stand_2
sector_1_stand_3
sector_2_stand_1
sector_2_stand_2
sector_2_stand_3

so i, j reacts as numbers in count, but when trying to generate list, they keep initialized values 0
:face_with_raised_eyebrow:

Nested loops can work in Thunkable but there are quite a few components that take too long to complete their code and don’t work inside of loops. You’re using a stored variable which is a slower method of storing/retrieving data in Thunkable. I wonder what happens if you use an app variable?

It’s very possible that you’re going to need to add some Wait blocks (possibly just wait 0 seconds) within the loop block(s) to slow things down.

Some very relevant info:

1 Like

@muneer already teached me how to deal in case of asynchronous issues :relaxed:
but i dont think is the case here.
anyway, i tried this too:


with the same null result

1 Like

this works

so i guess that count only works as a counter and those ii, jj variables dont keep values…
so i imagine that i need other 2 variables to keep results, and it works

2 Likes

@mimostel
I know you already solved your issue but I wanted to highlight something which should save you from creating lots of variables.

The variables inside the loops and parameters of functions are special type of variables.
You do not need to created app variables to use them as loop number holders.

When you add a loop block you can click on the variable to rename it like this,
image

image

image

image

Now you have a variable for the loop and is available as the name only without the app variable proceeding it.

4 Likes

Yeah but using 2 loops with same variabele Will rename Both variabeles.

1 Like

You can give each loop its own variable name in the same way I explained. I’m using it and I know it works.

1 Like

well, thank you, but doesnt work for me… it still rename both… this kind of aproach was my 1st…
maybe because i duplicate 1st loop for second when editing ? … ill retry now without duplicate and make second loop from the scratch

Later edit: yes, is working …

1 Like

Hmm that never really worked for me.
I’ll check it out later this day.
EDIT.
Now i understand it.
Haha
Thanks @muneer

1 Like