Personally i'd consider this better style than what you are doing now, and it's not harder to read or understand either...

03-10-2008

Dave_Sinkula

In this particular case, going by the pattern presented, my inclination would be to get rid of the switch entirely.

Code:

return data + (option - 'A' + 1);

(Of course noting possible character set issues.)

As far as switch cases, I have no issue using a return (and not needing a break after the return). The "problem" that the single point of return argument is supposed to solve tends to confuse me more than this returning "early" that I find simpler. YMMV.

03-10-2008

guillermoh

Thanks for your answer.

I would like to know if it's just matter of style or it is wrong to do it this way (my way)?