sI shouldn't have to stop and explain how if x != option4is equivalent toif x = option1or x = option2or x = option3and then having you complain about to me that you don't like seeing negative logic
2/6/2009 11:49:48 PM
The latter way is actually "safer," depending on the situation.
2/7/2009 12:01:21 AM
agreed, it also could be more maintainable in case an option 5 or 6 comes around
2/7/2009 12:11:03 AM
at least you're not dealing with a cocky subordinate report who submitted a massive checkin and even though you threatened him if he didn't profile the changes well managed to slip in a O(n^2) sorting algorithm that took down the system for 6 hours.Yeah I'm really looking forward to monday
2/7/2009 12:11:19 AM
^^ and ^^^acknowledged, this was not the exact situation more just an example to display the fact that I have to explain logic using NOT and the fact that for some reason most of the programmers I work with from other countries complain whenever they see something that isn't an AND or an OR or when you match to a FALSE as opposed to true.
2/7/2009 1:18:34 AM
I know how you feel, I've been there many times. I mean, I'm an arrogant know-it-all on the inside, but I'd rather have people like me and be willing to work with me, so I try to be understanding. You don't always get to choose who you work with (okay actually you never really do), and an employee whom everyone likes and wants to be around and cooperate with is orders of magnitude more valuable than some cocky kid.]
2/7/2009 1:33:36 AM
safety and personal preferences aside, if you're coding you should know the difference betweenif (x != option4)and if (x == option1 || x == option2 || x == option3)if x will have a value between option1 and option4
2/7/2009 1:47:16 PM
I guess the first one is faster, since the second might do 3 compares when x == option3
2/7/2009 2:19:15 PM
but the second one is safer
[Edited on February 7, 2009 at 2:28 PM. Reason :
2/7/2009 2:20:04 PM
not necessarily
2/7/2009 2:38:27 PM
shouldn't really be doing either of those, depending on what is setting x in the first place.
2/7/2009 4:32:07 PM
youre rightcase optionsesac is totally better
2/7/2009 4:48:11 PM
this reminds me of csc100. post some cool code
2/7/2009 8:07:46 PM
10 PRINT "BALLSACK"20 GOTO 10RUN
2/7/2009 8:19:17 PM
the only reason i could understand doing the second option is if options added later would be treated the same as option4, but it seems to be an edge case in this situation
2/7/2009 8:36:19 PM
2/7/2009 9:18:06 PM
Please, do the needful and advise.
2/7/2009 10:02:11 PM
OMG! All of the indians say that exact phrase!
2/7/2009 10:15:28 PM
^^i had no idea that is a common indian phrase. i'm working on a project in india now, and every email they send is closed with "please do the needful and advise"is it wrong that read their emails using Apu's voice from the simpsons in my head?
2/7/2009 10:30:43 PM
2/7/2009 11:22:40 PM
I get this all the timeLet me know for the same.
2/7/2009 11:34:55 PM
Ahh, you guys.I'm sure you get "gentle reminders" as wellhttp://en.wikipedia.org/wiki/Indian_English
2/8/2009 7:51:25 AM
My favorite hinglish phrase is "please revert back to me"]]
2/8/2009 9:22:29 AM
Please do the needful, it is very urgent.
2/8/2009 11:49:48 AM
A as in apple. C as in Charlie. E as in echo.
2/8/2009 12:02:07 PM
2/8/2009 3:33:33 PM
this is why i love wikipedia: http://en.wikipedia.org/wiki/Do_the_needfuloh, and click here and read till end... guarantee you will be lolling: http://en.wikipedia.org/wiki/Indian_English#Grammar.2C_idioms_and_usage_in_Indian_English
2/8/2009 4:55:11 PM
Arey, that is a long string, yaar?
2/8/2009 9:03:50 PM