From: mirian@... (Mirian Crzig Lennox) Date: 2001-05-29T11:18:30+09:00 Subject: [ruby-talk:15902] Re: is it possible to dynamically coerce objects types in Ruby? In article <3B38E23D@operamail.com>, Benjamin J. Tilly wrote: >You will not be far wrong if you think of "to_int" as being >to_i combined with the assertion that what you are dealing >with was supposed to be "integer-like". > >That is, to_i will endeavour to give you an integer, no matter >how poorly the shoe fits, while to_int will give you an >integer, but not if it means lopping off a toe or three in >the process. If you wish you can think of the missing "nt" >in to_i to represent the lopped off toes from trying to make >the shoe fit what it didn't... :-) *grin* I like this image. I didn't understand the different between the two methods at first, but it makes sense now. So this is why "Hello".to_i returns 0, but "Hello".to_int is an error. The 0 represents how many toes are left after making the shoe fit. :) --Mirian