[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Compare Array Values?

Gabriele Marrone

11/23/2006 2:00:00 AM


On 23/nov/06, at 02:48, Jason Mayer wrote:

> I thought I was going to get to contribute, but then I got stuck. I
> installed the latest ruby, wrote a quick program that I thought
> would do it,
> and it didn't. So I expanded on the program, trying to figure out
> what was
> going on, and now it's 20 lines long(mostly puts) and I *still*
> don't get
> something (Beware - the single most basic code ever follows - it was
> originally much nicer but then I got to trying to debug)
[...]
> if aSize = bSize
[...]
> What's wrong with if aSize = bSize? That seems the most intuitive
> way to do
> it to me... I mean, it's an integer... why is it going inside the
> loop at
> all?

Just a typo, = instead of == :P

Anyway, you're relying on the items to respond to <=>. Not every
array should be sortable, I think.
I was thinking of another way, but I'm still working on it...

--
Gabriele Marrone