Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Golf Challenge: FizzBuzz

by Moron (Curate)
on Mar 02, 2007 at 17:36 UTC ( #602915=note: print w/ replies, xml ) Need Help??


in reply to Golf Challenge: FizzBuzz

Or the slightly simplistic version that uses a precomputed LCM of 15:

print map $_%15?($_%5?($_%3?"$_\n":"fizz\n"):"buzz\n"):"fizzbuzz\n",(1 +..100);
update: typo corrected - thx liverpole

-M

Free your mind


Comment on Re: Golf Challenge: FizzBuzz
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-12-23 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (133 votes), past polls