[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

[bug] Array#first(symbol) doesn't raise?

Simon Strandgaard

10/24/2004 1:19:00 PM

irb(main):001:0> %w(a b c).first(:xyz)
=> ["a", "b", "c"]
irb(main):002:0> %w(a b c).last(:xyz)
=> ["a", "b", "c"]

This seems inconsistent to me. I would expect a TypeError.

--
Simon Strandgaard


2 Answers

ts

10/24/2004 1:25:00 PM

0

>>>>> "S" == Simon Strandgaard <neoneye@adslhome.dk> writes:

S> irb(main):001:0> %w(a b c).first(:xyz)

svg% ruby -we '%w(a b c).first(:xyz)'
-e:1: warning: treating Symbol as an integer
svg%



Guy Decoux


Simon Strandgaard

10/24/2004 1:36:00 PM

0

On Sunday 24 October 2004 15:25, ts wrote:
> ruby -we '%w(a b c).first(:xyz)'

Ah.. I see. You have good insight. Thanks.

--
Simon Strandgaard