5
It’s probably duplicated, but I didn’t find it here on Sopt, and I don’t know how to Google.
How the loop works for
in that syntax?
for(;;)
{
//...
}
5
It’s probably duplicated, but I didn’t find it here on Sopt, and I don’t know how to Google.
How the loop works for
in that syntax?
for(;;)
{
//...
}
11
In this specific form is a loop infinite. It will stop only when you have a break
.
The structure of a loop for, in most languages mainstream is the following:
for(inicializacao; condicao; pós loop)
Where:
inicializacao
: is a statement executed only once - before the first loop. It’s like a "pre-for";
condicao
is a statement executed before each loop and that will define whether the next loop will be executed or not. It is like the "stop condition" of the repeats, from the moment this statement return false
the repetitions end.
pós loop
is a statement that is executed after each loop.
Any of these options may be omitted, i.e., they may be statements empty. In this case, the statement will do exactly what you want: nothingness.
Thank you. Succinct and efficient answer, exactly what I wanted
Browser other questions tagged loop syntax for
You are not signed in. Login or sign up in order to post.
In what language?
– Wictor Chaves
It’s the same thing
while(true) { }
– Wallace Maxters
The question itself already answers: https://answall.com/q/90180/101
– Maniero
Infinite loop. Initializes nothing, has no stop condition, has no incremental step
– Jefferson Quesado
@Downvoter because the negative vote?
– Artur Trapp