Yet another WTF moment
boolean found = false; for (int pr=0; pr<promotions.length; pr++) { Promotion promotion = promotions[pr]; if (promotion!=null && promotion.getName().equals(""+availablePromotions[pr][a1].getPackageId())) { externalPromotions[pr] = externalPromotions[pr]; // WTF!!! Assigning a value to itself. found = true; // Not sure what this is break; } } found = false; // As soon as the loop exits this goes back to false again. WTF!!!
The above is an actual snippet of code from a production system (the comments are mine). And yes, I am serious.
Categories: WTF
Reblogged this on Dinesh Ram Kali..
I am pretty sure he learned the whole “found” methodology in a course featuring a language without a break statement.It can be used to emulate it with a few modifications.I am from Greece, and we learned such a language in the final year of high school.So yea, this is the work of a very, very confused mind.
ROFL!
Brilliant. I love things like this. Presumably at some point it modified something! Wouldn’t have happened with testing 🙂
I think that the code initially did something and then was modified hastily a couple of times.
Check out one of my WTF moments with Java http://www.coding-dude.com/wp/java/java-integer-equals-integer-wtf-moment-java/