r/javahelp • u/Encryp73r • Aug 09 '22
what does for(;;) mean?
Just like the title asks, what does for(;;) mean? A double semicolon in a for loop, I found it in some code I'm trying to understand and Google can't seem to answer my question. Thanks!
17
Upvotes
10
u/LambdaThrowawayy Aug 09 '22 edited Aug 09 '22
Any of the the three statements in a for-loop are optional; you don't have to include an initialization, termination or increment statement. Skipping out on all three creates an infinite loop.
See https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html for details.