Code snippets know no geographic boundaries.
Jose Sobrinho sends us a great abuses of IF statements all the way from Brazil. The best of his "pearls" is a real mind-bender:
If MyValue = 0 &MyValueDes = MyValueDes Else If MyValue = 1 &MyValueDes = MyValueDes Else If MyValue = 2 &MyValueDes = MyValueDes Else If MyValue = 3 &MyValueDes = MyValueDes Else If MyValue = 4 &MyValueDes = MyValueDes Else If MyValue = 5 &MyValueDes = MyValueDes Else If MyValue = 6 &MyValueDes = MyValueDes Else If MyValue = 7 &MyValueDes = MyValueDes Endif Endif Endif Endif Endif Endif Endif Endif
Why did the programmer use so many IF statements? One could easily use a single IF statement for controlling setting the variable, like this:
If MyValue >= 0 and MyValue <= 7 Then &MyValueDes = MyValueDes
If MyValue allows for non-integer values, then you'd add one more condition to make sure the current value is an integer... This programmer preferred to use gratuitous indent patterns, maybe they wanted to scroll down in the code and pretend they were playing Pitfall.
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!