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

S

Simon Strandgaard

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.
 
T

ts

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,888
Members
47,420
Latest member
ZitaVos505

Latest Threads

Top