# Need a bit of help

**URL:** <https://www.ruby-forum.com/t/need-a-bit-of-help/178778>\
**Category:** Ruby\
**Created:** [November 11, 2009, 7:10am UTC](https://www.ruby-forum.com/t/need-a-bit-of-help/178778 "2009-11-11T07:10:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bguan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8edcca/32.png) [@bguan](https://www.ruby-forum.com/u/bguan)\
**Post date:** [November 11, 2009, 7:10am UTC](https://www.ruby-forum.com/t/need-a-bit-of-help/178778/1 "2009-11-11T07:10:28Z")

</div>

Hey guys im trying to get this to work but I can’t for reason, can you  
look over it and tell me the problem, the first part will work 1-9 but  
when I do the array variable to 1-1000 I cant seem to get it to do it.  
Please Help heres the code

# def roman\_numeral(number)

# result = ‘’

# if number \> 5

```
# result = 'V' + 'I' * (number - 5)

```

# else

```
# result = 'I' * number

```

# end

# return result

# end

# (1…9).each() do |my\_number|

# puts roman\_numeral(my\_number)

# end

$numerals = [  
[1000, ‘M’],  
[500, ‘D’],  
[100, ‘C’],  
[50, ‘L’],  
[10, ‘X’],  
[5, ‘V’],  
[1, ‘I’]  
]  
def roman\_numeral(number)  
$numerals.each do |decimal, numeral|

# do something interesting with each decimal, numeral pair

end  
end  
(1…49).each() do |my\_number|  
puts roman\_numeral(my\_number)  
end

---

<div class="post-metadata">

**Author:** ![bguan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8edcca/32.png) [@bguan](https://www.ruby-forum.com/u/bguan)\
**Post date:** [November 11, 2009, 5:21pm UTC](https://www.ruby-forum.com/t/need-a-bit-of-help/178778/2 "2009-11-11T17:21:40Z")

</div>

On Nov 10, 2009, at 10:10 PM, Brian G. wrote:

> Hey guys im trying to get this to work but I can’t for reason, can you  
> look over it and tell me the problem, the first part will work 1-9 but  
> when I do the array variable to 1-1000 I cant seem to get it to do it.

Looks like we have another kid with the same homework. It is becoming  
pretty popular here ;-). Please look through yesterday’s subjects to  
find a relevant discussion. Or even better – think harder for yourself.

Gennady.
