On Tue, 17 Feb 2004, Cere Davis wrote: > Date: Tue, 17 Feb 2004 19:05:59 -0800 > From: Cere Davis <cere / u.washington.edu> > Newsgroups: comp.lang.ruby > Subject: boolean to int conversion > > > I'm a bit of a Ruby newbie so be kind pls. > > Could someone tell me if there's an easy way to make a value of True go to 1 and False goto 0? > > a sort of to_i method? > > Thanks, > Cere [true, false].each |bool| do int = (bool ? 1 : 0) p int end -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================