From: Jeremy Bopp Date: 2011-11-04T23:22:07+09:00 Subject: Re: I need help understanding this small piece of code On 11/4/2011 09:13, Fily Salas wrote: > What I don't know understand are the expressions surrounded with > parenthesis "(num % 1000 / 500) etc" > I do understand that we are passing a parameter when calling the method > and then multiplying the roman letters by this number passed as argument > but, what is... '(num % 1000 / 500)' = WHAT? > > ("number" "percentage" 1000 / 500) = WHAT? > > Can someone be so kind and explain this a little bit? I know this may > be my math but I don’t see (num % 1000 / 500) being a math equation. The % is a modulo operator. It performs integer division like / does but returns the remainder of the division rather than the quotient. When you com across something in Ruby you don't understand, it's helpful to open up irb and put in smaller parts of the problem to build your understanding from the ground up. -Jeremy