Originally posted by rjlohan
I'm aware of that. But if you were never going to have numbers over 1 then it would have made no difference, and using a function would have been pointless.
It's up to the designer or at least the design requirements to say which is necessary. If he was using this once in his program, then it would not be efficient to write a long-winded function to do a 1 line job.
I'm not saying one way or the other which is better, only that design considerations determine the best coding option to use.
But as I am not the developer, I tried to provide him code that would work in all possible situations since I did not know the type of numbers that he was running through.