- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Why, that's practically a Brazillian lines of code.
Admin
Admin
THIS would be MUCH better!
MyValue = 0 ? &MyValue = MyValue : MyValue = 1 ? &MyValue = MyValue : MyValue = 2 ? &MyValue = MyValue : MyValue = 3 ? &MyValue = MyValue : MyValue = 4 ? &MyValue = MyValue : MyValue = 5 ? &MyValue = MyValue : MyValue = 6 ? &MyValue = MyValue : MyValue = 7 ? &MyValue = MyValue : break;
Admin
I suspect OCD.
Admin
Some others have noted above that it's possible the original code was written with the intent that the requirements would change for each value between 1 and 7.
But surely a "Select Case" structure would have been more efficient?
Admin
This equivalent code is 16% shorter (and 50% narrower).
-Harrow.
Admin
You must be one of my coworkers then. I found exactly that during a review of some consultant's code the other day.
The number was 30 instead of 7 though, and there were no else statements, so all conditions would be evaluated for every iteration.
Admin
Am I the only one wondering what SWITCH is a mnemonic for?
SWITCH Word Is The Crazy Heuristic
And what about "very universal"? Is it possible to be more universal than ... universal? Once something is universal, isn't that pretty much it? Where do you go from there?
Admin
I think I have a better one. I once saw this in some VB code I was maintaining
if (((VAL1=VAL2)=true)=true) then....
Not a joke. We paid these guys $100.00 per hour for stuff like this.
--PatF
Admin
Could be FoxPro!
Admin
dear god you guys laugh at that code then half of you cant write it better... my verison in vb: if (myValue <= 7) and (myValue >= 0) and (int(myValue) = myValue) then &MyValueDes = MyValueDes end if
however my real question is what lanuage is this really, because in vb &MyValueDes = MyValueDes is redundent
Admin
boykbbyh http://gndwrkdc.com rkrwptny xsmbwfxg
Admin
mwarfnik http://pptbwnsd.com fxzuekyq gdfyrxcn
Admin
If you would like to grow your know-how only keep visiting this website and be updated with the most up-to-date news update posted here. https://66bb4C96e165c.site123.me/