View Single Post
Old 10-26-2006, 05:29 AM   #7 (permalink)
noobie
Forum Expert
 
Join Date: Jul 2005
Location: Istanbul/Turkey
Age: 27
Posts: 425
Default

I wouldnt want to go over any code you guys have written

Speed is really irrevelant in such a case and you cant really say shorter code is the fastest one.

I would write it as clear as possible and in a more logical way.

this is clear but it is not logical
Code:
if ( a==1)
{
   if (b==5)
      stuff
   else if (b==6)
      stuff
   else if (b==7)
      stuff
}
else if (b==5)
{
   if (a==2)
      stuff
   else if (a==3)
      stuff
}
just use:
Code:
if (a==1)
//bla bla
else
//..
or
Code:
if (a==xx && b==zz)
else if ..
__________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."
noobie is offline   Reply With Quote