Similar Posts

Subscribe
Notify of
7 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
mihisu
8 months ago

How can the counter reach the 10? In the While loop, the value of the variable Zaehler is nowhere increased!

(And it doesn’t look like a different process would run in parallel that would affect the variable.)

“Test” is repeatedly output and waited for a short time without any change in this. You have an endless loop.

Devrunrik
7 months ago

There’s something going on while it’s smaller

ohwehohach
8 months ago

You need to increase the counting variable within the “while” block somewhere – otherwise you just have an endless loop.

Suiram1
8 months ago

The counter is nowhere incremented or the value otherwise changed and thus has never a value greater than or equal to 10 which is required for the output “Next Test”. You would have to increment Zaehler after the If (or where different) so that it is possible to take a For loop.

lg Suiram1

Dultus, UserMod Light

A good day, dear,

let’s go through your code.

Zaehler = 1

as long as the counter is less than or equal to 10:

write “Test”

Wait 1ms

If the counter is greater than or equal to 10, write “Next test”

Ready.

And how should the Zaehler reach 10? He stays one because you don’t raise him. You have an endless loop.

Best regards

CuteOtter
8 months ago

Let’s just go through this in mind:

Zaehler is 1
The grinding head checks whether Zaehler is <= 0.
Yeah, it is. So he’s giving out “test.”
Then he’ll wait a second.
Then he checks if Zaehler is greater than or equal to 0.
If he is not, he skips the task.

Simple answer: He doesn’t give “Next test” because Zaehler is smaller than 10.

I assume that you noticed that you built an endless loop because your counter is not raised.

VanLorry
8 months ago

Your counter doesn’t count. You initialize the variable, but then it no longer changes.