Quote:
Originally Posted by GeeTwo
Provided that the code is equally (or arguably better) readable by people, why not give the computer the simplest directions?
|
For an example where the simpler code is not easier to read:
Logically, you want to do a conditional:
if (c is between a and b, and you don't know whether a is larger or smaller than b) then...
Human simpler (use this!):
if ((a<b) && (b<c) || (a>b) && (b>c)) then..
Probably machine quicker, but don't use:
if ((a-b)*(b-c) > 0) then..