Nested While loop in a For loop

Good day!
I have an input list - no.1 which will be turn out to output list - no.2. And i want to achieve that result by using Imperative block. i try with t0 and it work, but no chance for t1 which is a nested while loop in a for loop.
Could you help me to figure it out?
Any help will be appriciated!
Thank you!

Hi @Nicolas.B

here you are trying to itterate through a number and not a list (an array). You need to adjust slightly the first loop like this.

for (i in 0..count1 - 1)

I also don’t fully understand why using this to put everything into an additonal list when you have already a list with everything you need after execution.

t2 = List.AddItemToEnd(tem_t2, t2);

and delete this to avoid quiting the loop after the first itteration

return t1;

1 Like

thank you very much, Meychik!
i was wrong when itterate a number (i in count), it should be: for (i in lst) or for (i in 0…count1 - 1) as you pointed out.

1 Like