From: Todd Benson Date: 2008-03-05T03:23:24+09:00 Subject: Re: Class and inheritance On Tue, Mar 4, 2008 at 8:50 AM, August0866 wrote: > OK, 2 dumb questions What is the difference between a class and a > module and > > What is wrong here, the logic or the syntax > > Npc, def => job)> > > def job > if > @power.to_f > 12 && @smarts.to_f > 14 && @speed.to_f > 14 > @job = 'Adventurer' > elsif > @power.to_f > 14 and (@smarts.to_f <14 or @speed.to_f < 14) > @job = 'laborer' > elsif > @power.to_f < 14 and (@smarts.to_f > 14 and @speed.to_f > 14) > @job = 'coureror' > elsif > @power.to_f < 14 and (@smarts.to_f > 14 and @speed.to_f < 14) > @job='teacher' > else > @job = 'commoner' > end > end > > > the result is sometimes joe is an adventurer otherwise nothing is > output Not sure, but I think the logic. (@smarts.to_f < 14 or @speed.to_f < 14) will be true the same time (@smarts.to_f > 14 and @speed.to_f < 14) is true. Your decision set is not mutually exclusive because of that first 12 (What if your 13?). Just a guess... Todd