On Sat, Mar 9, 2013 at 11:56 AM, Kumar R. <lists / ruby-forum.com> wrote:

> With the below code what it did - casting or conversion?
>
> "12".to_i #=> 12
> "abc12".to_i #=> 0
>

I wouldn't use either word for this. I'd call it "coersion".

Ruby does support a form of "casting" using the "Integer" method:

irb(main):001:0> Integer("12")
=> 12
irb(main):002:0> Integer("abc12")
ArgumentError: invalid value for Integer(): "abc12"

-- 
Tony Arcieri