On Nov 11, 2009, at 11:59 AM, Benoit D. wrote:
]
You just need to manage how to save this in your String at each step.
(You can multiply a String by “X” * 3, and concatenate using << (or +=))Give us your script when you’ll got one working
In case you have missed it from yesterday, a slightly modified original
solution was:
def roman_numeral(number)
$numerals.inject(["", number]) { |(result, number), (order, roman)|
[ result + roman * (number / order), number % order ]
}.first
end
It works with shortened numerals for 4, 9, 40, 90, 400, 900 as well.
Gennady.