While instruction

Can someone tell me where I can find documentation of the while instruction?
I’m using a code where I need to exit from a while loop, but the instruction “break;” apparently does not work.
Thanks.

Using break will exit a while block. Please post your code to help diagnose the issue.

1 Like

Hello,
I tested the infinite loop code:

while(1){
break;
}

while and break are C/C++ “primitives”, hence you’d find documentation online virtually everywhere.

while


break

2 Likes

What is the context for this snippet? The break will indeed break out of the infinite loop. However, if you placed this code inside the loop() function, it will just be called again by the system, perhaps appearing to have never exited.

It was just for test the break instruction, to exit from an infinite loop.