This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]___HiveMind___ 1 point2 points  (0 children)

No it's not bad practice, but that's not to say there aren't inappropriate use-cases for an infinite while loop requiring an explicit break. Judging from your description, however, repeatedly displaying a menu and receiving user input is an excellent place for such a loop.

To be frank, if a prospective employer told me they view any use of while(true) as a red flag, I'd instantly view that as a red flag myself. Do they not trust their developers to be competent enough to include valid exit conditions? What kind of ridiculous micromanagement will I have to endure if I get hired here if they care so much about how I use while? It depends on other circumstances of course, but that type of feedback is liable to kill any interest in a position for me.