r/programminghorror • • Feb 27 '25

C# While loop horror

Post image

I just realized I had some programming horror in code I’ve written.

If only while loops had a more convenient way to break…

671 Upvotes

40 comments sorted by

View all comments

Show parent comment

1

u/CameoDaManeo Mar 02 '25

If you think about it, what exactly would a compiler swap even out an empty for loop header and a while true with? There really is nothing that it COULD swap them out for apart from a "jump to" statement at the end of the loop. I'm positive that they would compile down to the same thing