Another Horror
-
Narotham Babu Kalluri wrote:
I've found this piece of code recently in my new project if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }
Since this programmer obviously can't make a switch in code, your company should make a switch of employees.
if (a >= 1 && a <= 4)
DoSomething(a);is a better option than a
switch
I think :) .Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
-
if (a >= 1 && a <= 4)
DoSomething(a);is a better option than a
switch
I think :) .Greetings - Gajatko Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
gajatko wrote:
if (a >= 1 && a <= 4) DoSomething(a); is a better option than a switch I think .
Hmmmm...in this case, yes :)
-
I've found this piece of code recently in my new project
if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }
And this part is written in many places of the applicationLOL
-
I've found this piece of code recently in my new project
if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }
And this part is written in many places of the applicationThat is almost beautiful in it's inelegance! It is hard to come up with something convoluted and still have code that looks like the person writing it didn't try hard to make it as convoluted as possible...
-
gajatko wrote:
if (a >= 1 && a <= 4) DoSomething(a); is a better option than a switch I think .
Hmmmm...in this case, yes :)
-
I've found this piece of code recently in my new project
if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }
And this part is written in many places of the application -
VentsyV wrote:
And that's why your previous post got voted down.
:laugh: once I start caring, I might start paying attention to the scores.
-
VentsyV wrote:
And that's why your previous post got voted down.
:laugh: once I start caring, I might start paying attention to the scores.
-
VentsyV wrote:
That post was for Paul Conrad's benefit really.
A pity, then, that it appeared as a reply to MY post. I am an INNOCENT BYSTANDER!! :^)
-
I've found this piece of code recently in my new project
if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }
And this part is written in many places of the application -
I've found this piece of code recently in my new project
if(a==1 || a==2 || a==3 || a==4) { if(a==1) DoSomething(1); else if(a==2) DoSomething(2); else if(a==3) DoSomething(3); else if(a==4) DoSomething(4); }
And this part is written in many places of the application