Richard D. wrote in post #1078909:
> def roman num
>   roman = '' #assuming creating roman variable that's empty
>   roman = roman + 'M' * (num/1000) #adding Ms to roman variable
>   roman = roman + 'D' * (num%1000/500)
>   roman = roman + 'C' * (num%500/100)
>   roman = roman + 'L' * (num%100/50)
>   roman = roman + 'X' * (num%50/10)
>   roman = roman + 'V' * (num%10/5)
>   roman = roman + 'I' * (num%5/1)
>
>   roman # don't understand purpose of line
> endhanks for the help in advance.



Hi,

By the way, I wouldn't use a local variable with the same name as the 
method. That's quite confusing and forces you to use paranthesis or an 
explicit receiver when you actually do want to call the method.

And I would replace the pattern

sum = sum + ...

with the short form

sum += ...

That's shorter and (in my opionion) more readable.

-- 
Posted via http://www.ruby-forum.com/.