in reply to Re^2: Terse Code for Odd Numbers
in thread Terse Code for Odd Numbers

Was said test asking for the shortest possible answer or simply testing your coding ability? Not to be pedantic, they aren't the same. Those of us who have to communicate with other programmers, write or maintain code, or teach, may disagree with your concept of 'better answer'.

I'd prefer a three line solution above that used a foreach simply for readability.

--
jpg

Replies are listed 'Best First'.
Re^4: Terse Code for Odd Numbers
by kwaping (Priest) on May 13, 2005 at 20:51 UTC
    I have no votes left today, but ++ for jpeg's answer above. I was about to say "golfing an obfuscated answer probably wouldn't be a good idea", though of course it is FUN! :) But since this is just as an exercise and not for the test anymore, golf away!