For loop block doesn't seem execute the code every time

Hi,

I am Santhi. I started using MIT APP Inventor recently. I started creating a small app. But I couldn't make this for loop work properly. Can anyone guide me?
Attached is the simple for-loop block. Am I doing something wrong?

What are you trying to achieve ? Using this loop when button click TextBox recieves values 1,2,3...9 but it is so fast and you only see 9

1 Like

You can use a Clock Component instead of For loop.

Can you provide more information?
If you only see 9 in your text box, because it was already executed until the last step.
If you want to see 1, 2, 3, ...
you need to use this block:

2 Likes

@momoney with the above blocks the result will be almost the same. If your text is a for example you will only see a9 cause the loop will execute immediately all values till last one

2 Likes

As @dora_paz already asked, what exactly should be achieved?
However, play around with this and try to get what you want.

2 Likes

Thank you. Understood. Is there a way I can add some delay like "system.sleep(ms)"

Will look at the clock component. Thank you.

Thank you. I will experiment with join block.

Hi, Thank you. I want to achieve the below.1) I want to call "Text to Speech" component in a loop with a delay in each iteration. Look like I need to experiment

Thank you Anke. I will experiment with join block and clock components.

Thank you momoey. I will experiment with join blocks.

Why didn't you let us know at the beginning?
What delay?

grafik

Thank you Anke. I thought of simplifying the problem.
Now I get it. Thank you.

There is also the event block for speech end, which can be used with a temporary list .

Here is an example ...

An alternative technique using lists can be found in

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.