From: "David A. Black" Date: 2004-02-28T10:43:22+09:00 Subject: Re: Arabic # -> Roman # (Was: TDD Roman Numeral tutorial in Ruby) Hi -- On Sat, 28 Feb 2004, Josef 'Jupp' SCHUGT wrote: > #!/usr/bin/env ruby > > n1 = [ 'I', 'X', 'C', 'M' ] > n5 = [ 'V', 'L', 'D', nil ] > > max = 0 > > n1.each_index { |i| max += 3 * 10 ** i } > n5.each_index { |i| max += 5 * 10 ** i unless i.nil? } i will never be nil -- it will always be an integer. (Did you mean "unless n5[i].nil?'?) David -- David A. Black dblack@wobblini.net