From: Cere Davis Date: 2004-02-20T20:22:27+09:00 Subject: Re: boolean to int conversion Thanks everyone for help on this... Ara.T.Howard wrote: > On Tue, 17 Feb 2004, Cere Davis wrote: > > >>Date: Tue, 17 Feb 2004 19:05:59 -0800 >>From: Cere Davis >>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