On 12/1/05, Matthew Feadler <matthew / feadler.com> wrote:
> Since I've gotten the go-ahead from Christer, here's a little newbie app
> I just wrote and am looking for advice on how to better write:
[snip]


def rollAttributePair
 rolls = Array.new
 rolls.push(Die.new(10).roll)
 rolls.push(Die.new(10).roll)
 if (rolls[0] == 0) or (rolls[1] == 0)
   total = 0
   return total
 else
   total = (rolls[0] - rolls[1])
   return total
 end
end


maybe write it like this   (untested)

def roll_attribute_pair
 r1 = Die.new(10).roll
 r2 = Die.new(10).roll
 return 0 if (r1 == 0) or (r2 == 0)
 (r1 - r2)
end


--
Simon Strandgaard