[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: [QUIZ] FizzBuzz (#126

darren kirby

6/1/2007 9:05:00 PM

quoth the Ari Brown:
> Hey all, I have a quick question on this quiz:
> I have a working version of it, but I just want to compare and see
> what everyone else got.
>
> How many lines do you have it written in?
>
> That's my big problem - making programs too long.
>
> thanks,
> ~ Ari
> English is like a pseudo-random number generator - there are a
> bajillion rules to it, but nobody cares.

Mine is 8 lines (not including the shebang) two of which are 'end's. I wrote
it in probably the most obvious way, so it's certainly not 'clever' or
anything.

-d
--
darren kirby :: Part of the problem since 1976 :: http://badco...
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972

1 Answer

Rick DeNatale

6/1/2007 9:59:00 PM

0

On 6/1/07, darren kirby <bulliver@badcomputer.org> wrote:
> quoth the Ari Brown:
> > Hey all, I have a quick question on this quiz:
> > I have a working version of it, but I just want to compare and see
> > what everyone else got.
> >
> > How many lines do you have it written in?
> >
> > That's my big problem - making programs too long.
> >
> > thanks,
> > ~ Ari
> > English is like a pseudo-random number generator - there are a
> > bajillion rules to it, but nobody cares.
>
> Mine is 8 lines (not including the shebang) two of which are 'end's. I wrote
> it in probably the most obvious way, so it's certainly not 'clever' or
> anything.

As I said, I wrote 6 different versions, all of them are methods on
Integer, and a (1..100).each {|i| p i.fizz_buzzn)

where n is an integer.

The most obvious method has 8 lines inside the def/end, while the
shortest has one.
--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...