Question: Can anyone explain how to read this code and what it will do?

```
'D' * (num % 1000 / 500)

```

It is from a method for converting integers to Roman numerals. I don't understand how it functions.

Answer: 
The expression (num % 1000 / 500) means "if you have in your last 3 digits a number greater than 500 then evaluate to 1 otherwise evaluate to 0" 

"D" \* (0 or 1) is determining whether to put "D" on the roman number or not.
See [this](http://www.tutorialspoint.com/ruby/ruby_operators.htm) page and scroll down to Ruby Operators Precedence.

Multiplication, division, and modular arithmetic are all together, so precedence is left to right IIRC.

First, `num % 1000` is evaluated. Then, that is divided by `500`. That's then multiplied by 'D'.