menu

arrow_back C# loop for (; ;)?

by
0 votes
How to understand this? This "for (; ;)" sugar is?
Couldn't find because the search engines do not understand the symbols.

2 Answers

by
 
Best answer
0 votes
for (initializer; condition; iterator)
body

initializer - set some initial state
condition - the condition of the loop exit
iterator - an action that will happen every time at the end of the step cycle

these comrades are not mandatory, in your case, there is no including the termination condition of the cycle, so this cycle will last indefinitely

more details here well Google better English =)
by
0 votes
In the for loop, three blocks, each of which is optional. Can be omitted and the initialization and the condition (if it is considered always true), and post-action.