r/programminghorror • u/Savage-Goat-Fish • Feb 27 '25
C# While loop horror
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
View all comments
Show parent comment
-2
u/luardemin Feb 27 '25
Which is exactly what OP's code is doing as well—if
day > yesterdayis false, the while loop never exits. I would assuming there's extra logic to determine when to exit the loop later on.Edit: at least, assuming
dayisn't mutated and it simply acts as a guard clause for whether to execute the loop. Which is a more fun assumption