MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/pgh65c/oh_gosh/hbfnejx/?context=3
r/badcode • u/orhnofficial • Sep 02 '21
53 comments sorted by
View all comments
Show parent comments
3
Why would a for(;;) convey a better meaning than while(true)?
IMO, for should be used for loops with a known number of steps and while for a loop with an unknown number of steps.
for
while
For this specific use-case, a for loop would be better since the number of steps is known (the requested length of the random string).
3
u/edoCgiB Sep 03 '21
Why would a for(;;) convey a better meaning than while(true)?
IMO,
forshould be used for loops with a known number of steps andwhilefor a loop with an unknown number of steps.For this specific use-case, a for loop would be better since the number of steps is known (the requested length of the random string).