|
Posted by Steve on 09/04/07 22:05
> if (!mostLikelyValue) {
> performSomeAction();
> }
> theRequiredAction();
>
> Where in my opinion the second one is more readable and the first one
> probably faster (?)
the one shown above is the format i like, esp. if all you do is 'break;' in
the if/else struct. as for faster...they perform the same...exactly the
same. and if you get this technical over the code, you're doomed to never
finish an application...at least on time that is.
as a rule, i stay away from if/else constructs as much as possible. well, i
don't 'stay away'...i simply think out a problem and work out its solution
in different terms than most...and i don't find myself using
if/else...generally, i just 'if' and 'switch' (but i don't do a whole run of
branching logic in those either). that's just me and it involves a whole
other approach to programming that i can't just dive right into and discuss
coherently.
Navigation:
[Reply to this message]
|