Infinite while loop issue

Hi @Teodor ,

can you check this sc where i am having problems. I think this should work. but it goes into an endless loop and I don’t get any results.

You call your var loopHour but then you use loop for the expression and incLoop for the variable inside the loop?
The var inside the loop should have the same name as the one before the loop: incLoop. Also the expression for the loop must also be using it.

yes, I wrote Loop in the Global field. I thought the global field would be in the same scope. I did as you said, but the result I got is as follows.

image

However, the result I want is to print the result to the screen in each loop. How can I do that ?

What exactly are you trying to achieve?

As a result of the loop, I need to get an output as follows.

image

1 to 24

So why not use repeat then?

I thought the correct method was “while”.

However, there seems to be a problem with the use of while ? Am I thinking wrong?

Loop won’t print each step like that. The repeat does.

To try this out, I just created an example to write each loop result to the database, but no records were added to the database. Can you confirm it on your side please. However, I think it should print to the screen.

I also tested this and it works perfectly:

Screenshot 2022-05-10 at 11.23.00

yeap

yes it is because of loop value string and a space. I did this as number and removed the space, no problem. It doesn’t print like you said. I don’t know exactly what is the reason for this. Why can’t I get output on the screen?
image

@patrick

1 Like

It made a mistake because the value in the loop was marked as output . For this reason, I thought that each loop would write its output to the screen. Is there a special reason for using while?

thanks komşu :slight_smile:
@patrick knows.

1 Like

Why not use a standard repeat in this case, with the repeat you can use a number instead of an array to repeat a number of times.

Yes, I am using it that way now. But I just wondered why “while” doesn’t give an output.

2 Likes