Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 browsing the Monastery: (9)
As of 2015-01-29 13:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (238 votes), past polls