From: Mathieu Bouchard Date: 2002-01-13T05:34:51+09:00 Subject: Re: I/O gets and integers On Sun, 13 Jan 2002, Tobias Reif wrote: > Mathieu Bouchard wrote: > > If you want to accept both Integers and Floats, you can do > > this: (temp=gets; Integer(temp) rescue Float(temp)) > > so if you want you can append .to_f to that to make > > sure every result is a Float even when it was written as an Integer. > In this case, perhaps simply > out = Float(str) rescue str > ? (without Integer() and .to_f) > Tobi oh. you are right. didn't think about this one. ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju