Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Terse Code for Odd Numbers

by jpeg (Chaplain)
on May 13, 2005 at 20:43 UTC ( [id://456893]=note: print w/replies, xml ) Need Help??


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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://456893]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-04-19 13:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found