I've been looking through some sample source code for an application I use and I came across this line:
for (;;)
{
// The rest of the application's code
}
It looks like this is to create an infinite loop, but I'm not familiar with ";;" and it's very hard to Google unfortunately.
Yes, that is an infinite loop. It's an ordinary for loop with no condition expression.
From the documentation for for
:
All of the expressions of the for statement are optional; for example, the following statement is used to write an infinite loop:
for (; ; ) { // ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With