From: Brian Candler Date: 2010-11-19T06:03:22+09:00 Subject: Re: Passing a variable Sayth Renshaw wrote in post #961804: > # Bank = A running total > def pool > if Bank > 200 then Bank * 0.05 > Else $10.00 > end > > def ROIcalc2 > ((xunits * max_return)/pool)*100 > Per > end > > # scenario 1 > xunits = (0.6)step(0.8, 0.05) > Per = 190 > puts "What ratio of return do you expect?" > gets.chomp > ROI = (gets.chomp).to_f > max_return = pool * ROI > when xunits in ROIcalc2(xunits, max_return, pool, Per) is true then > Xunits_2 = 1.0 - xunits > puts "xunits equals " + xunits + " xunits2 equals " + Xunits_2 > else > puts " This is am invalid option please choose another option " > end What language is this in? Did you try running it? Getting your code to work is arguably more important than style :-) -- Posted via http://www.ruby-forum.com/.